From 1936ffcb7b4acb98f435941db6423657e3d8c498 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Thu, 28 Dec 2017 11:04:40 +0300 Subject: [PATCH] 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. --- pthread_stop_world.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pthread_stop_world.c b/pthread_stop_world.c index 781c23b..6e9f406 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 -- 2.7.4