diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2013-07-15 16:02:36 +0400 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2013-07-15 16:02:36 +0400 |
commit | 991f1a8a5ced31df77ea81a1f53116a8b5f34eea (patch) | |
tree | 4b16f23bff3728a981705a4893d0708de81c79b9 /win32_threads.c | |
parent | 84c483185f85bc574eeea2ae316d25062a02d296 (diff) | |
download | bdwgc-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.c | 2 |
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 |