summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Chambers <joncham@gmail.com>2020-07-28 14:34:16 -0400
committerIvan Maidanski <ivmai@mail.ru>2021-08-21 01:04:28 +0300
commitfa0a8f734f28ab08bab2511705eca3cfdfe5ec27 (patch)
tree090bd99d4b4253b9cf0d8b4c4bc9e642ec4261e6
parentd36396a7f94593c7e55b55909fee00953c52b5d0 (diff)
downloadbdwgc-fa0a8f734f28ab08bab2511705eca3cfdfe5ec27.tar.gz
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.
-rw-r--r--darwin_stop_world.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/darwin_stop_world.c b/darwin_stop_world.c
index 2872bc03..3dbaa3fb 100644
--- a/darwin_stop_world.c
+++ b/darwin_stop_world.c
@@ -196,10 +196,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);