diff options
author | George Hazan <george.hazan@gmail.com> | 2014-07-13 10:50:59 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-07-13 10:50:59 +0000 |
commit | 5df94ff719eccd04c7450df35fb5e3f2b36e2ee7 (patch) | |
tree | 440d736b199ff849ca0619adf355ffc73750ca7f /protocols/IRCG/src/commandmonitor.cpp | |
parent | 70496fb739225b559a251f4518c946110aef718c (diff) |
wrapping the most evident critical sections into a class
git-svn-id: http://svn.miranda-ng.org/main/trunk@9785 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/IRCG/src/commandmonitor.cpp')
-rw-r--r-- | protocols/IRCG/src/commandmonitor.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index 52d4b03d20..ad1a374ce4 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -237,22 +237,22 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, TCHAR* msg) void __cdecl CIrcProto::ResolveIPThread(LPVOID di)
{
IPRESOLVE* ipr = (IPRESOLVE *)di;
-
- EnterCriticalSection(&m_resolve);
-
- if (ipr != NULL && (ipr->iType == IP_AUTO && lstrlenA(m_myHost) == 0 || ipr->iType == IP_MANUAL)) {
- hostent* myhost = gethostbyname(ipr->sAddr.c_str());
- if (myhost) {
- IN_ADDR in;
- memcpy(&in, myhost->h_addr, 4);
- if (ipr->iType == IP_AUTO)
- mir_snprintf(m_myHost, sizeof(m_myHost), "%s", inet_ntoa(in));
- else
- mir_snprintf(m_mySpecifiedHostIP, sizeof(m_mySpecifiedHostIP), "%s", inet_ntoa(in));
+ {
+ mir_cslock lock(m_resolve);
+
+ if (ipr != NULL && (ipr->iType == IP_AUTO && lstrlenA(m_myHost) == 0 || ipr->iType == IP_MANUAL)) {
+ hostent* myhost = gethostbyname(ipr->sAddr.c_str());
+ if (myhost) {
+ IN_ADDR in;
+ memcpy(&in, myhost->h_addr, 4);
+ if (ipr->iType == IP_AUTO)
+ mir_snprintf(m_myHost, sizeof(m_myHost), "%s", inet_ntoa(in));
+ else
+ mir_snprintf(m_mySpecifiedHostIP, sizeof(m_mySpecifiedHostIP), "%s", inet_ntoa(in));
+ }
}
}
- LeaveCriticalSection(&m_resolve);
delete ipr;
}
|