From: Ivan Maidanski Date: Thu, 28 Dec 2017 08:04:40 +0000 (+0300) Subject: Add assertion for suspend_ack_sem in start_world X-Git-Tag: v8.0.0~435 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1936ffcb7b4acb98f435941db6423657e3d8c498;p=gc 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. --- 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