X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fincludes%2FOSThreads.h;h=90431445b7befaf93a4d200a2405a5a54d1937fa;hb=86f2671b37507012692a53c2fe45357b0988cb40;hp=40c260bc0feddd397c9dd443d3f5331f8f309487;hpb=2846bc8a8a6a02851dd62e2c04be358902eee204;p=ghc-hetmet.git diff --git a/ghc/includes/OSThreads.h b/ghc/includes/OSThreads.h index 40c260b..9043144 100644 --- a/ghc/includes/OSThreads.h +++ b/ghc/includes/OSThreads.h @@ -90,6 +90,19 @@ typedef DWORD ThreadLocalKey; #if USE_CRITICAL_SECTIONS 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 RELEASE_LOCK(mutex) LeaveCriticalSection(mutex) @@ -97,6 +110,8 @@ typedef CRITICAL_SECTION Mutex; // the right thing. #define ASSERT_LOCK_HELD(mutex) /* nothing */ +#endif + #else typedef HANDLE Mutex;