From 5df94ff719eccd04c7450df35fb5e3f2b36e2ee7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 13 Jul 2014 10:50:59 +0000 Subject: 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 --- protocols/AimOscar/src/utility.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'protocols/AimOscar/src/utility.cpp') diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index 00af4417d4..28678182a4 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -135,15 +135,14 @@ bool CAimProto::wait_conn(HANDLE& hConn, HANDLE& hEvent, unsigned short service) { if (m_iStatus == ID_STATUS_OFFLINE) return false; - - EnterCriticalSection(&connMutex); - if (hConn == NULL && hServerConn) { - debugLogA("Starting Connection."); - hConn = (HANDLE)1; //set so no additional service request attempts are made while aim is still processing the request - aim_new_service_request(hServerConn, seqno, service) ;//general service connection! + mir_cslock lck(connMutex); + if (hConn == NULL && hServerConn) { + debugLogA("Starting Connection."); + hConn = (HANDLE)1; //set so no additional service request attempts are made while aim is still processing the request + aim_new_service_request(hServerConn, seqno, service);//general service connection! + } } - LeaveCriticalSection(&connMutex); if (WaitForSingleObjectEx(hEvent, 10000, TRUE) != WAIT_OBJECT_0) return false; -- cgit v1.2.3