Listing 2 MyWaitForSingleObject && MyReleaseMutex
#include "locksWrapper.h" void MyWaitForSingleObject(HANDLE hResource, DWORD dwMilliseconds) { PostThreadMessage(CLocksMonitorMgr::GetLMThreadId(), WM_LM_TRY_LOCK, (WPARAM)GetCurrentThreadId(), (LPARAM)hResource); WaitForSingleObject(hResource, dwMilliseconds); PostThreadMessage(CLocksMonitorMgr::GetLMThreadId(), WM_LM_OWN_LOCK, (WPARAM)GetCurrentThreadId(), (LPARAM)hResource); } void MyReleaseMutex(HANDLE hMutex) { ReleaseMutex(hMutex); PostThreadMessage(CLocksMonitorMgr::GetLMThreadId(), WM_LM_RELEASE_LOCK, (WPARAM)GetCurrentThreadId(), (LPARAM)hMutex); }