summaryrefslogtreecommitdiff
path: root/rts/posix
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2009-01-17 21:59:31 +0000
committerIan Lynagh <igloo@earth.li>2009-01-17 21:59:31 +0000
commitdd3d9333b2e2f6a0959bb4aebbad5bf23e968fb6 (patch)
tree6983a3bcdaf6a0c86fe6f28c6c6b3ed2d2bf3d15 /rts/posix
parentee8e3c3f0124c6ca53fecae80a673c79168dedf8 (diff)
downloadhaskell-dd3d9333b2e2f6a0959bb4aebbad5bf23e968fb6.tar.gz
Use error-checking mutexes on all platforms when DEBUG is on
Otherwise ASSERT_LOCK_HELD will cause deadlocks
Diffstat (limited to 'rts/posix')
-rw-r--r--rts/posix/OSThreads.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index 510a51d445..ee4958a2e8 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -104,10 +104,14 @@ osThreadIsAlive(OSThreadId id STG_UNUSED)
void
initMutex(Mutex* pMut)
{
-#if defined(DEBUG) && defined(linux_HOST_OS)
+#if defined(DEBUG)
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
+#if defined(linux_HOST_OS)
pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_ERRORCHECK_NP);
+#else
+ pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_ERRORCHECK);
+#endif
pthread_mutex_init(pMut,&attr);
#else
pthread_mutex_init(pMut,NULL);