From 1baf656e5a86afded0c792639fc5976351e310df Mon Sep 17 00:00:00 2001 From: Jonathan Chambers Date: Tue, 28 Jul 2020 14:34:16 -0400 Subject: Add loop to handle abort error like in suspend logic on Darwin (a cherry-pick of commit 60d0e0b7d from Unity-Technologies/bdwgc) * darwin_stop_world.c (GC_stack_range_for): Retry thread_get_state(GC_MACH_THREAD_STATE) while KERN_ABORTED. --- darwin_stop_world.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'darwin_stop_world.c') diff --git a/darwin_stop_world.c b/darwin_stop_world.c index c4caf62c..24e41294 100644 --- a/darwin_stop_world.c +++ b/darwin_stop_world.c @@ -199,10 +199,12 @@ STATIC ptr_t GC_stack_range_for(ptr_t *phi, thread_act_t thread, GC_thread p, /* else */ { mach_msg_type_number_t thread_state_count = GC_MACH_THREAD_STATE_COUNT; - /* Get the thread state (registers, etc) */ - kern_result = thread_get_state(thread, GC_MACH_THREAD_STATE, - (natural_t *)&state, - &thread_state_count); + /* Get the thread state (registers, etc.) */ + do { + kern_result = thread_get_state(thread, GC_MACH_THREAD_STATE, + (natural_t *)&state, + &thread_state_count); + } while (kern_result == KERN_ABORTED); } # ifdef DEBUG_THREADS GC_log_printf("thread_get_state returns value = %d\n", kern_result); -- cgit v1.2.1