added check to detect special synchonisation issues on windows in debug-mode

This commit is contained in:
Andrey Prygunkov
2007-12-25 14:37:19 +00:00
parent 8a33307b6c
commit c72c8df5e9

View File

@@ -63,6 +63,14 @@ void Mutex::Lock()
{
#ifdef WIN32
EnterCriticalSection(&m_mutexObj);
#ifdef DEBUG
// CriticalSections on Windows can be locked many times from the same thread,
// but we do not want this and must treat such situations as errors and detect them.
if (m_mutexObj.RecursionCount > 1)
{
error("Internal program error: inconsistent thread-lock detected");
}
#endif
#else
pthread_mutex_lock(&m_mutexObj);
#endif