Commit 3d9ae0ef authored by kr.angelov@gmail.com's avatar kr.angelov@gmail.com
Browse files

support LOCK_DEBUG for Windows

parent 0ab0232d
...@@ -90,6 +90,19 @@ typedef DWORD ThreadLocalKey; ...@@ -90,6 +90,19 @@ typedef DWORD ThreadLocalKey;
#if USE_CRITICAL_SECTIONS #if USE_CRITICAL_SECTIONS
typedef CRITICAL_SECTION Mutex; typedef CRITICAL_SECTION Mutex;
#ifdef LOCK_DEBUG
#define ACQUIRE_LOCK(mutex) \
debugBelch("ACQUIRE_LOCK(0x%p) %s %d\n", mutex,__FILE__,__LINE__); \
EnterCriticalSection(mutex)
#define RELEASE_LOCK(mutex) \
debugBelch("RELEASE_LOCK(0x%p) %s %d\n", mutex,__FILE__,__LINE__); \
LeaveCriticalSection(mutex)
#define ASSERT_LOCK_HELD(mutex) /* nothing */
#else
#define ACQUIRE_LOCK(mutex) EnterCriticalSection(mutex) #define ACQUIRE_LOCK(mutex) EnterCriticalSection(mutex)
#define RELEASE_LOCK(mutex) LeaveCriticalSection(mutex) #define RELEASE_LOCK(mutex) LeaveCriticalSection(mutex)
...@@ -97,6 +110,8 @@ typedef CRITICAL_SECTION Mutex; ...@@ -97,6 +110,8 @@ typedef CRITICAL_SECTION Mutex;
// the right thing. // the right thing.
#define ASSERT_LOCK_HELD(mutex) /* nothing */ #define ASSERT_LOCK_HELD(mutex) /* nothing */
#endif
#else #else
typedef HANDLE Mutex; typedef HANDLE Mutex;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment