From: Ian Lynagh Date: Sat, 17 Jan 2009 21:59:31 +0000 (+0000) Subject: Use error-checking mutexes on all platforms when DEBUG is on X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=commitdiff_plain;h=dd3d9333b2e2f6a0959bb4aebbad5bf23e968fb6 Use error-checking mutexes on all platforms when DEBUG is on Otherwise ASSERT_LOCK_HELD will cause deadlocks --- diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c index 510a51d..ee4958a 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);