]> granicus.if.org Git - gc/commitdiff
Fix suspend_thread_list in case of thread_suspend is interrupted
authorIvan Maidanski <ivmai@mail.ru>
Fri, 27 Jul 2018 10:01:19 +0000 (13:01 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Mon, 6 Aug 2018 06:48:42 +0000 (09:48 +0300)
(fix of commit e8cdc7c)

* darwin_stop_world.c [!GC_NO_THREADS_DISCOVERY]
(GC_suspend_thread_list): Retry thread_suspend if failed with
KERN_ABORTED.

darwin_stop_world.c

index 5bfa98a06ce9fb9da853b160ec01b78b0ddfce5c..29918d113c30ed410860e27938e169596e50e1b5 100644 (file)
@@ -440,7 +440,9 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
 #   ifdef DEBUG_THREADS
       GC_log_printf("Suspending 0x%lx\n", (unsigned long)thread);
 #   endif
-    kern_result = thread_suspend(thread);
+    do {
+      kern_result = thread_suspend(thread);
+    } while (kern_result == KERN_ABORTED);
     if (kern_result != KERN_SUCCESS) {
       /* The thread may have quit since the thread_threads() call we  */
       /* mark already suspended so it's not dealt with anymore later. */