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>
Fri, 27 Jul 2018 10:06:08 +0000 (13:06 +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 fe04a08..e59339c 100644 (file)
@@ -536,7 +536,9 @@ STATIC GC_bool GC_suspend_thread_list(thread_act_array_t act_list, int count,
 #   ifdef DEBUG_THREADS
       GC_log_printf("Suspending %p\n", (void *)(word)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. */