summaryrefslogtreecommitdiff
path: root/darwin_stop_world.c
diff options
context:
space:
mode:
authorJonathan Chambers <joncham@gmail.com>2020-07-28 14:34:16 -0400
committerIvan Maidanski <ivmai@mail.ru>2021-07-12 14:52:53 +0300
commit1baf656e5a86afded0c792639fc5976351e310df (patch)
tree599878d2df355ec53654ae4c2ff3169871499fac /darwin_stop_world.c
parentcbbaccc09611ece1ab43ef61ed39981c3fbc676f (diff)
downloadbdwgc-1baf656e5a86afded0c792639fc5976351e310df.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.
Diffstat (limited to 'darwin_stop_world.c')
-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 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);