summaryrefslogtreecommitdiff
path: root/ghc/includes
diff options
context:
space:
mode:
authorkr.angelov@gmail.com <unknown>2006-02-22 20:17:21 +0000
committerkr.angelov@gmail.com <unknown>2006-02-22 20:17:21 +0000
commit3d9ae0ef3505f158b8ed1e2c8d655a581074d3a2 (patch)
tree1cf827b488684c5ba268354e560324fd118ddca2 /ghc/includes
parent0ab0232d2eadd68cf3973bc3f36ae5135d199a9a (diff)
downloadhaskell-3d9ae0ef3505f158b8ed1e2c8d655a581074d3a2.tar.gz
support LOCK_DEBUG for Windows
Diffstat (limited to 'ghc/includes')
-rw-r--r--ghc/includes/OSThreads.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/ghc/includes/OSThreads.h b/ghc/includes/OSThreads.h
index 40c260bc0f..90431445b7 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;