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/services.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/services.cpp')
-rw-r--r-- | protocols/IRCG/src/services.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index 02e7fdbc0d..ae0ecb7267 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -499,7 +499,7 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) GCHOOK *gch = (GCHOOK*)lParam;
CMString S = _T("");
- EnterCriticalSection(&m_gchook);
+ mir_cslock lock(m_gchook);
// handle the hook
if (gch) {
@@ -769,7 +769,6 @@ int __cdecl CIrcProto::GCEventHook(WPARAM wParam, LPARAM lParam) }
}
- LeaveCriticalSection(&m_gchook);
return 0;
}
@@ -906,7 +905,7 @@ int __cdecl CIrcProto::GCMenuHook(WPARAM, LPARAM lParam) int __cdecl CIrcProto::OnPreShutdown(WPARAM, LPARAM)
{
- EnterCriticalSection(&cs);
+ mir_cslock lock(cs);
if (m_perform && IsConnected())
if (DoPerform("Event: Disconnect"))
@@ -922,8 +921,6 @@ int __cdecl CIrcProto::OnPreShutdown(WPARAM, LPARAM) m_nickDlg->Close();
if (m_joinDlg)
m_joinDlg->Close();
-
- LeaveCriticalSection(&cs);
return 0;
}
@@ -1011,9 +1008,10 @@ void __cdecl CIrcProto::ConnectServerThread(void*) nickflag = true;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)Temp, ID_STATUS_CONNECTING);
Sleep(100);
- EnterCriticalSection(&cs);
- Connect(si);
- LeaveCriticalSection(&cs);
+ {
+ mir_cslock lock(cs);
+ Connect(si);
+ }
if (IsConnected()) {
if (m_mySpecifiedHost[0])
ForkThread(&CIrcProto::ResolveIPThread, new IPRESOLVE(m_mySpecifiedHost, IP_MANUAL));
|