From dd3d9333b2e2f6a0959bb4aebbad5bf23e968fb6 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Sat, 17 Jan 2009 21:59:31 +0000 Subject: [PATCH] Use error-checking mutexes on all platforms when DEBUG is on Otherwise ASSERT_LOCK_HELD will cause deadlocks --- rts/posix/OSThreads.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); -- 1.7.10.4