summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2009-01-26 14:00:30 +0000
committerSimon Marlow <marlowsd@gmail.com>2009-01-26 14:00:30 +0000
commit9f35f6715879b9e81ffd538c3049e2dd243f807e (patch)
tree78abd89f5f5dddc042c9ae8914dc32d63ebba50e /includes
parentff124db4ad2ea145a13c711d4da9e293fa82f58d (diff)
downloadhaskell-9f35f6715879b9e81ffd538c3049e2dd243f807e.tar.gz
add comment for ASSERT_LOCK_HELD()
Diffstat (limited to 'includes')
-rw-r--r--includes/OSThreads.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/includes/OSThreads.h b/includes/OSThreads.h
index fd57f56606..d4dbc361e1 100644
--- a/includes/OSThreads.h
+++ b/includes/OSThreads.h
@@ -54,6 +54,11 @@ typedef pthread_key_t ThreadLocalKey;
barf("RELEASE_LOCK: I do not own this lock: %s %d", __FILE__,__LINE__); \
}
+// Note: this assertion calls pthread_mutex_lock() on a mutex that
+// is already held by the calling thread. The mutex should therefore
+// have been created with PTHREAD_MUTEX_ERRORCHECK, otherwise this
+// assertion will hang. We always initialise mutexes with
+// PTHREAD_MUTEX_ERRORCHECK when DEBUG is on (see rts/posix/OSThreads.h).
#define ASSERT_LOCK_HELD(mutex) ASSERT(pthread_mutex_lock(mutex) == EDEADLK)
#endif // CMINUSMINUS