About CMutex And CSingleLock
-
I'm using CSingleLock , When one thread lock an object, and other thread wants to lock that object at that time , The second thread will wait for unlocking by the 1st thread or it just skip that locking code. If it need to wait, It will automatically wait or have to give code to wait ? -------------------------------------------------------------------------- CMutex g_m1; CSingleLock lock1(&g_m1) - - - - - - - -- - - - - - - - - - - - - - - - - - - - if (lock1.Lock()) { m_LockStatus = "Got Lock"; UpdateData(FALSE); } else { m_LockStatus = "Failed"; UpdateData(FALSE); } } ----------------------------------------------------------------------------- Thanks to all.:)
-
I'm using CSingleLock , When one thread lock an object, and other thread wants to lock that object at that time , The second thread will wait for unlocking by the 1st thread or it just skip that locking code. If it need to wait, It will automatically wait or have to give code to wait ? -------------------------------------------------------------------------- CMutex g_m1; CSingleLock lock1(&g_m1) - - - - - - - -- - - - - - - - - - - - - - - - - - - - if (lock1.Lock()) { m_LockStatus = "Got Lock"; UpdateData(FALSE); } else { m_LockStatus = "Failed"; UpdateData(FALSE); } } ----------------------------------------------------------------------------- Thanks to all.:)
you may try :-
WaitForSingleObject
Regards, FarPointer Blog:FARPOINTER