summaryrefslogtreecommitdiff
path: root/plugins/Quotes
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2015-04-30 06:00:43 +0000
committerKirill Volinsky <mataes2007@gmail.com>2015-04-30 06:00:43 +0000
commite08a7cc8649d735a166879a3c1cf0b1642c651d1 (patch)
tree1916876b0586ea5bf1c00b22e59e274708e3b61d /plugins/Quotes
parent481296bc540cdbdd0efef87ddaa173c96619edc3 (diff)
minus critical section
git-svn-id: http://svn.miranda-ng.org/main/trunk@13268 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Quotes')
-rw-r--r--plugins/Quotes/Forex_10.vcxproj2
-rw-r--r--plugins/Quotes/Forex_10.vcxproj.filters6
-rw-r--r--plugins/Quotes/Forex_12.vcxproj2
-rw-r--r--plugins/Quotes/Forex_12.vcxproj.filters6
-rw-r--r--plugins/Quotes/src/HTMLParserMS.cpp2
-rw-r--r--plugins/Quotes/src/HTMLParserMS.h2
-rw-r--r--plugins/Quotes/src/HTTPSession.cpp4
-rw-r--r--plugins/Quotes/src/LightMutex.cpp21
-rw-r--r--plugins/Quotes/src/LightMutex.h34
-rw-r--r--plugins/Quotes/src/Log.cpp4
-rw-r--r--plugins/Quotes/src/ModuleInfo.cpp6
-rw-r--r--plugins/Quotes/src/QuotesProviderBase.cpp18
-rw-r--r--plugins/Quotes/src/QuotesProviderBase.h2
-rw-r--r--plugins/Quotes/src/QuotesProviderDukasCopy.cpp6
-rw-r--r--plugins/Quotes/src/QuotesProviderFinance.cpp4
-rw-r--r--plugins/Quotes/src/QuotesProviderGoogle.cpp4
-rw-r--r--plugins/Quotes/src/stdafx.h1
17 files changed, 26 insertions, 98 deletions
diff --git a/plugins/Quotes/Forex_10.vcxproj b/plugins/Quotes/Forex_10.vcxproj
index 4586541d11..58f551eeba 100644
--- a/plugins/Quotes/Forex_10.vcxproj
+++ b/plugins/Quotes/Forex_10.vcxproj
@@ -180,7 +180,6 @@
<ClCompile Include="src\HTTPSession.cpp" />
<ClCompile Include="src\IconLib.cpp" />
<ClCompile Include="src\ImportExport.cpp" />
- <ClCompile Include="src\LightMutex.cpp" />
<ClCompile Include="src\Locale.cpp" />
<ClCompile Include="src\Log.cpp" />
<ClCompile Include="src\ModuleInfo.cpp" />
@@ -224,7 +223,6 @@
<ClInclude Include="src\IQuotesProvider.h" />
<ClInclude Include="src\IsWithinAccuracy.h" />
<ClInclude Include="src\IXMLEngine.h" />
- <ClInclude Include="src\LightMutex.h" />
<ClInclude Include="src\Locale.h" />
<ClInclude Include="src\Log.h" />
<ClInclude Include="src\ModuleInfo.h" />
diff --git a/plugins/Quotes/Forex_10.vcxproj.filters b/plugins/Quotes/Forex_10.vcxproj.filters
index a0c3db7784..fff39af327 100644
--- a/plugins/Quotes/Forex_10.vcxproj.filters
+++ b/plugins/Quotes/Forex_10.vcxproj.filters
@@ -48,9 +48,6 @@
<ClCompile Include="src\ImportExport.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\LightMutex.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\Locale.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -167,9 +164,6 @@
<ClInclude Include="src\IXMLEngine.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\LightMutex.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\Locale.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/Quotes/Forex_12.vcxproj b/plugins/Quotes/Forex_12.vcxproj
index 8c7e8b08fa..621f3c579e 100644
--- a/plugins/Quotes/Forex_12.vcxproj
+++ b/plugins/Quotes/Forex_12.vcxproj
@@ -183,7 +183,6 @@
<ClCompile Include="src\HTTPSession.cpp" />
<ClCompile Include="src\IconLib.cpp" />
<ClCompile Include="src\ImportExport.cpp" />
- <ClCompile Include="src\LightMutex.cpp" />
<ClCompile Include="src\Locale.cpp" />
<ClCompile Include="src\Log.cpp" />
<ClCompile Include="src\ModuleInfo.cpp" />
@@ -227,7 +226,6 @@
<ClInclude Include="src\IQuotesProvider.h" />
<ClInclude Include="src\IsWithinAccuracy.h" />
<ClInclude Include="src\IXMLEngine.h" />
- <ClInclude Include="src\LightMutex.h" />
<ClInclude Include="src\Locale.h" />
<ClInclude Include="src\Log.h" />
<ClInclude Include="src\ModuleInfo.h" />
diff --git a/plugins/Quotes/Forex_12.vcxproj.filters b/plugins/Quotes/Forex_12.vcxproj.filters
index 53168a3a39..2254a91e42 100644
--- a/plugins/Quotes/Forex_12.vcxproj.filters
+++ b/plugins/Quotes/Forex_12.vcxproj.filters
@@ -48,9 +48,6 @@
<ClCompile Include="src\ImportExport.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\LightMutex.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\Locale.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -167,9 +164,6 @@
<ClInclude Include="src\IXMLEngine.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\LightMutex.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\Locale.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/plugins/Quotes/src/HTMLParserMS.cpp b/plugins/Quotes/src/HTMLParserMS.cpp
index bdc6316ab6..72cc913b8a 100644
--- a/plugins/Quotes/src/HTMLParserMS.cpp
+++ b/plugins/Quotes/src/HTMLParserMS.cpp
@@ -230,7 +230,7 @@ CHTMLParserMS::THTMLNodePtr CHTMLParserMS::ParseString(const tstring& rsHTML)
try
{
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
OLECHAR* p = T2OLE(const_cast<LPTSTR>(rsHTML.c_str()));
CComPtr<IMarkupContainer> pMC;
diff --git a/plugins/Quotes/src/HTMLParserMS.h b/plugins/Quotes/src/HTMLParserMS.h
index 2a2673e720..ac01ac2d32 100644
--- a/plugins/Quotes/src/HTMLParserMS.h
+++ b/plugins/Quotes/src/HTMLParserMS.h
@@ -17,7 +17,7 @@ private:
CComPtr<IMarkupServices> m_pMS;
CComPtr<IMarkupPointer> m_pMkStart;
CComPtr<IMarkupPointer> m_pMkFinish;
- mutable CLightMutex m_cs;
+ mutable mir_cs m_cs;
};
class CHTMLEngineMS : public IHTMLEngine
diff --git a/plugins/Quotes/src/HTTPSession.cpp b/plugins/Quotes/src/HTTPSession.cpp
index f54a5cc69c..3cf0c407b7 100644
--- a/plugins/Quotes/src/HTTPSession.cpp
+++ b/plugins/Quotes/src/HTTPSession.cpp
@@ -172,7 +172,7 @@ namespace
NETLIBHTTPREQUEST* pReply = NULL;
{
- CGuard<CLightMutex> guard(m_mx);
+ mir_cslock lck(m_mx);
pReply = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION,
reinterpret_cast<WPARAM>(g_hNetLib), reinterpret_cast<LPARAM>(&nlhr)));
}
@@ -215,7 +215,7 @@ namespace
static HANDLE g_hNetLib;
typedef std::vector<char> TBuffer;
mutable TBuffer m_aURL;
- mutable CLightMutex m_mx;
+ mutable mir_cs m_mx;
};
HANDLE CImplMI::g_hNetLib = NULL;
diff --git a/plugins/Quotes/src/LightMutex.cpp b/plugins/Quotes/src/LightMutex.cpp
deleted file mode 100644
index 88f79c4388..0000000000
--- a/plugins/Quotes/src/LightMutex.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-#include "StdAfx.h"
-
-CLightMutex::CLightMutex()
-{
- InitializeCriticalSection(&m_cs);
-}
-
-CLightMutex::~CLightMutex()
-{
- ::DeleteCriticalSection(&m_cs);
-}
-
-void CLightMutex::Lock()
-{
- ::EnterCriticalSection(&m_cs);
-}
-
-void CLightMutex::Unlock()
-{
- ::LeaveCriticalSection(&m_cs);
-}
diff --git a/plugins/Quotes/src/LightMutex.h b/plugins/Quotes/src/LightMutex.h
deleted file mode 100644
index e8c7363ba1..0000000000
--- a/plugins/Quotes/src/LightMutex.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef __a33da2bb_d4fe4aa7_aaf5_f9f8c3156ce6_LightMutex_h__
-#define __a33da2bb_d4fe4aa7_aaf5_f9f8c3156ce6_LightMutex_h__
-
-class CLightMutex
-{
-public:
- CLightMutex();
- ~CLightMutex();
-
- void Lock();
- void Unlock();
-
-private:
- CRITICAL_SECTION m_cs;
-};
-
-template<class TObject> class CGuard
-{
-public:
- CGuard(TObject& obj) : m_obj(obj)
- {
- m_obj.Lock();
- }
-
- ~CGuard()
- {
- m_obj.Unlock();
- }
-
-private:
- TObject& m_obj;
-};
-
-#endif //__a33da2bb_d4fe4aa7_aaf5_f9f8c3156ce6_LightMutex_h__
diff --git a/plugins/Quotes/src/Log.cpp b/plugins/Quotes/src/Log.cpp
index 844ffc7385..a9ffb93389 100644
--- a/plugins/Quotes/src/Log.cpp
+++ b/plugins/Quotes/src/Log.cpp
@@ -2,7 +2,7 @@
namespace
{
- CLightMutex g_Mutex;
+ mir_cs g_Mutex;
tstring get_log_file_name()
{
@@ -20,7 +20,7 @@ namespace
void do_log(const tstring& rsFileName, const tstring& rsMsg)
{
- CGuard<CLightMutex> guard(g_Mutex);
+ mir_cslock lck(g_Mutex);
tofstream file(rsFileName.c_str(), std::ios::ate | std::ios::app);
if (file.good())
{
diff --git a/plugins/Quotes/src/ModuleInfo.cpp b/plugins/Quotes/src/ModuleInfo.cpp
index 980a5241bc..656d17ad64 100644
--- a/plugins/Quotes/src/ModuleInfo.cpp
+++ b/plugins/Quotes/src/ModuleInfo.cpp
@@ -4,7 +4,7 @@ namespace
{
CModuleInfo::TXMLEnginePtr g_pXMLEngine;
CModuleInfo::THTMLEnginePtr g_pHTMLEngine;
- CLightMutex g_lmParsers;
+ mir_cs g_lmParsers;
}
CModuleInfo::CModuleInfo()
@@ -58,7 +58,7 @@ CModuleInfo::TXMLEnginePtr CModuleInfo::GetXMLEnginePtr()
{
if (!g_pXMLEngine)
{
- CGuard<CLightMutex> cs(g_lmParsers);
+ mir_cslock lck(g_lmParsers);
if (!g_pXMLEngine)
{
mir_getXI(&xi);
@@ -78,7 +78,7 @@ CModuleInfo::THTMLEnginePtr CModuleInfo::GetHTMLEngine()
{
if (!g_pHTMLEngine)
{
- CGuard<CLightMutex> cs(g_lmParsers);
+ mir_cslock lck(g_lmParsers);
if (!g_pHTMLEngine)
{
g_pHTMLEngine = THTMLEnginePtr(new CHTMLEngineMS);
diff --git a/plugins/Quotes/src/QuotesProviderBase.cpp b/plugins/Quotes/src/QuotesProviderBase.cpp
index dfb1c59d1d..e080025278 100644
--- a/plugins/Quotes/src/QuotesProviderBase.cpp
+++ b/plugins/Quotes/src/QuotesProviderBase.cpp
@@ -248,7 +248,7 @@ void CQuotesProviderBase::AddContact(MCONTACT hContact)
void CQuotesProviderBase::DeleteContact(MCONTACT hContact)
{
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
TContracts::iterator i = std::find(m_aContacts.begin(), m_aContacts.end(), hContact);
if (i != m_aContacts.end())
@@ -824,7 +824,7 @@ MCONTACT CQuotesProviderBase::CreateNewContact(const tstring& rsName)
db_set_ts(hContact, QUOTES_PROTOCOL_NAME, DB_STR_QUOTE_SYMBOL, rsName.c_str());
db_set_ts(hContact, LIST_MODULE_NAME, CONTACT_LIST_NAME, rsName.c_str());
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
m_aContacts.push_back(hContact);
}
else {
@@ -922,7 +922,7 @@ void CQuotesProviderBase::Run()
TContracts anContacts;
{
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
anContacts = m_aContacts;
}
@@ -960,7 +960,7 @@ void CQuotesProviderBase::Run()
m_sTendencyFormat = Quotes_DBGetStringT(NULL, QUOTES_PROTOCOL_NAME, visitor.m_pszDbTendencyFormat, visitor.m_pszDefTendencyFormat);
{
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
anContacts = m_aContacts;
}
break;
@@ -973,7 +973,7 @@ void CQuotesProviderBase::Run()
}
{
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
anContacts = m_aRefreshingContacts;
m_aRefreshingContacts.clear();
}
@@ -987,7 +987,7 @@ void CQuotesProviderBase::Run()
case WAIT_TIMEOUT:
nTimeout = get_refresh_timeout_miliseconds(visitor);
{
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
anContacts = m_aContacts;
}
{
@@ -1007,7 +1007,7 @@ void CQuotesProviderBase::OnEndRun()
{
TContracts anContacts;
{// for CCritSection
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
anContacts = m_aContacts;
m_aRefreshingContacts.clear();
}
@@ -1030,7 +1030,7 @@ void CQuotesProviderBase::RefreshSettings()
void CQuotesProviderBase::RefreshAllContacts()
{
{// for CCritSection
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
m_aRefreshingContacts.clear();
std::for_each(std::begin(m_aContacts), std::end(m_aContacts), [&](MCONTACT hContact){m_aRefreshingContacts.push_back(hContact); });
}
@@ -1042,7 +1042,7 @@ void CQuotesProviderBase::RefreshAllContacts()
void CQuotesProviderBase::RefreshContact(MCONTACT hContact)
{
{// for CCritSection
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
m_aRefreshingContacts.push_back(hContact);
}
diff --git a/plugins/Quotes/src/QuotesProviderBase.h b/plugins/Quotes/src/QuotesProviderBase.h
index 6e923b693c..b7f226fab3 100644
--- a/plugins/Quotes/src/QuotesProviderBase.h
+++ b/plugins/Quotes/src/QuotesProviderBase.h
@@ -102,7 +102,7 @@ private:
protected:
TContracts m_aContacts;
- mutable CLightMutex m_cs;
+ mutable mir_cs m_cs;
private:
typedef boost::scoped_ptr<CXMLFileInfo> TXMLFileInfoPtr;
diff --git a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp
index a2aaa28e93..43e91012c6 100644
--- a/plugins/Quotes/src/QuotesProviderDukasCopy.cpp
+++ b/plugins/Quotes/src/QuotesProviderDukasCopy.cpp
@@ -38,7 +38,7 @@ bool CQuotesProviderDukasCopy::WatchForQuote(const CQuote& rQuote, bool bWatch)
{
MCONTACT hContact = *i;
{// for CCritSection
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
m_aContacts.erase(i);
}
@@ -69,7 +69,7 @@ tstring CQuotesProviderDukasCopy::BuildHTTPURL()const
sURL << GetURL();
{
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
for (TContracts::const_iterator i = m_aContacts.begin(); i != m_aContacts.end(); ++i)
{
MCONTACT hContact = *i;
@@ -272,7 +272,7 @@ void CQuotesProviderDukasCopy::Accept(CQuotesProviderVisitor& visitor)const
MCONTACT CQuotesProviderDukasCopy::GetContactByQuoteID(const tstring& rsQuoteID)const
{
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
TContracts::const_iterator i = std::find_if(m_aContacts.begin(), m_aContacts.end(),
boost::bind(std::equal_to<tstring>(), rsQuoteID, boost::bind(get_quote_id, _1)));
diff --git a/plugins/Quotes/src/QuotesProviderFinance.cpp b/plugins/Quotes/src/QuotesProviderFinance.cpp
index 78e7444987..4dac495ff1 100644
--- a/plugins/Quotes/src/QuotesProviderFinance.cpp
+++ b/plugins/Quotes/src/QuotesProviderFinance.cpp
@@ -37,7 +37,7 @@ bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote, bool bWatch)
{
MCONTACT hContact = *i;
{// for CCritSection
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
m_aContacts.erase(i);
}
@@ -64,7 +64,7 @@ bool CQuotesProviderFinance::WatchForQuote(const CQuote& rQuote, bool bWatch)
MCONTACT CQuotesProviderFinance::GetContactByQuoteID(const tstring& rsQuoteID)const
{
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
TContracts::const_iterator i = std::find_if(m_aContacts.begin(), m_aContacts.end(),
boost::bind(std::equal_to<tstring>(), rsQuoteID, boost::bind(get_quote_id, _1)));
diff --git a/plugins/Quotes/src/QuotesProviderGoogle.cpp b/plugins/Quotes/src/QuotesProviderGoogle.cpp
index 50beba86aa..09d765cc34 100644
--- a/plugins/Quotes/src/QuotesProviderGoogle.cpp
+++ b/plugins/Quotes/src/QuotesProviderGoogle.cpp
@@ -57,7 +57,7 @@ bool CQuotesProviderGoogle::WatchForRate(const CRateInfo& ri,
{
MCONTACT hContact = *i;
{// for CCritSection
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
m_aContacts.erase(i);
}
@@ -508,7 +508,7 @@ namespace
MCONTACT CQuotesProviderGoogle::GetContactByID(const tstring& rsFromID, const tstring& rsToID)const
{
- CGuard<CLightMutex> cs(m_cs);
+ mir_cslock lck(m_cs);
TContracts::const_iterator i = std::find_if(m_aContacts.begin(), m_aContacts.end(),
boost::bind(is_equal_ids, _1, boost::cref(rsFromID), boost::cref(rsToID)));
diff --git a/plugins/Quotes/src/stdafx.h b/plugins/Quotes/src/stdafx.h
index 25a7a074fd..4096f1c191 100644
--- a/plugins/Quotes/src/stdafx.h
+++ b/plugins/Quotes/src/stdafx.h
@@ -100,7 +100,6 @@ inline int quotes_stricmp(LPCTSTR p1, LPCTSTR p2)
#include "SettingsDlg.h"
#include "CreateFilePath.h"
#include "Locale.h"
-#include "LightMutex.h"
#include "ExtraImages.h"
#include "IsWithinAccuracy.h"
#include "OptionDukasCopy.h"