Do not call sem_getvalue in stop_world if one thread exists
authorIvan Maidanski <ivmai@mail.ru>
Thu, 28 Dec 2017 08:18:25 +0000 (11:18 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 28 Dec 2017 08:18:25 +0000 (11:18 +0300)
* pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL] (GC_stop_world):
Do not call sem_getvalue() if n_live_threads is zero (matters only if
GC_retry_signals).

pthread_stop_world.c

index 6e9f406..bda842c 100644 (file)
@@ -808,7 +808,7 @@ GC_INNER void GC_stop_world(void)
     AO_store_release(&GC_world_is_stopped, TRUE);
     n_live_threads = GC_suspend_all();
 
-    if (GC_retry_signals) {
+    if (GC_retry_signals && n_live_threads > 0) {
       unsigned long wait_usecs = 0;  /* Total wait since retry. */
 #     define WAIT_UNIT 3000
 #     define RETRY_INTERVAL 100000