summaryrefslogtreecommitdiff
path: root/win32_threads.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2013-07-15 16:02:36 +0400
committerIvan Maidanski <ivmai@mail.ru>2013-07-15 16:02:36 +0400
commit991f1a8a5ced31df77ea81a1f53116a8b5f34eea (patch)
tree4b16f23bff3728a981705a4893d0708de81c79b9 /win32_threads.c
parent84c483185f85bc574eeea2ae316d25062a02d296 (diff)
downloadbdwgc-991f1a8a5ced31df77ea81a1f53116a8b5f34eea.tar.gz
Add double-lock assertion to GC_acquire_mark_lock
* pthread_support.c (GC_acquire_mark_lock): Add assertion that GC_mark_lock_holder is not set to the current thread on the function entry (i.e., assertion against double lock). * win32_threads.c (GC_acquire_mark_lock): Likewise.
Diffstat (limited to 'win32_threads.c')
-rw-r--r--win32_threads.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/win32_threads.c b/win32_threads.c
index 32e42ce3..2462c2a3 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -1786,6 +1786,7 @@ GC_INNER void GC_get_next_stack(char *start, char *limit,
GC_INNER void GC_acquire_mark_lock(void)
{
+ GC_ASSERT(GC_mark_lock_holder != NUMERIC_THREAD_ID(pthread_self()));
if (pthread_mutex_lock(&mark_mutex) != 0) {
ABORT("pthread_mutex_lock failed");
}
@@ -1971,6 +1972,7 @@ GC_INNER void GC_get_next_stack(char *start, char *limit,
GC_INNER void GC_acquire_mark_lock(void)
{
+ GC_ASSERT(GC_mark_lock_holder != (unsigned long)GetCurrentThreadId());
# ifdef DONT_USE_SIGNALANDWAIT
if (InterlockedExchange(&GC_mark_mutex_state, 1 /* locked */) != 0)
# else