summaryrefslogtreecommitdiff
path: root/pthread_stop_world.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2017-12-28 11:04:40 +0300
committerIvan Maidanski <ivmai@mail.ru>2017-12-28 11:05:50 +0300
commit1936ffcb7b4acb98f435941db6423657e3d8c498 (patch)
treeadb413316479bfab9c21fea02cbbb89789ef6aee /pthread_stop_world.c
parent6a6c0def28b0bfea1a9dc59e50cfafa42a71f880 (diff)
downloadbdwgc-1936ffcb7b4acb98f435941db6423657e3d8c498.tar.gz
Add assertion for suspend_ack_sem in start_world
This is to check that sem_post() is not called twice for a thread (to stop) in GC_suspend_handler. * pthread_stop_world.c [!NACL && GC_ASSERTIONS && !GC_OPENBSD_UTHREADS] (GC_start_world): Add assertion that GC_suspend_ack_sem has zero value.
Diffstat (limited to 'pthread_stop_world.c')
-rw-r--r--pthread_stop_world.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index 781c23b0..6e9f4062 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -1099,6 +1099,13 @@ GC_INNER void GC_start_world(void)
}
}
# endif
+# if defined(GC_ASSERTIONS) && !defined(GC_OPENBSD_UTHREADS)
+ {
+ int ack_count;
+ sem_getvalue(&GC_suspend_ack_sem, &ack_count);
+ GC_ASSERT(0 == ack_count);
+ }
+# endif
# ifdef DEBUG_THREADS
GC_log_printf("World started\n");
# endif