summaryrefslogtreecommitdiff
path: root/pthread_stop_world.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-04-14 09:33:31 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-04-17 12:50:55 +0300
commit83e997eb65cf2d52a649617f6a31d4af6fef8fb8 (patch)
tree302898c74676255bc4f87a6630afc6a47e514835 /pthread_stop_world.c
parent74f043e0f3ed647def2c7ef5699c2d1ac8845995 (diff)
downloadbdwgc-83e997eb65cf2d52a649617f6a31d4af6fef8fb8.tar.gz
Remove thread_blocked field in GC_thread
(refactoring) * darwin_stop_world.c (GC_stack_range_for): Remove thread_blocked argument; replace thread_blocked with !p||!(p->flags&DO_BLOCKING). * darwin_stop_world.c (GC_push_all_stacks): Remove thread_blocked argument in GC_stack_range_for() call. * darwin_stop_world.c (GC_stop_world, GC_start_world): Replace p->thread_blocked with p->flags&DO_BLOCKING. * pthread_stop_world.c [!GC_OPENBSD_UTHREADS && !NACL && GC_ENABLE_SUSPEND_THREAD] (GC_suspend_thread): Likewise. * pthread_stop_world.c (GC_push_all_stacks): Likewise. * pthread_stop_world.c [!NACL] (GC_suspend_all, GC_restart_all): Likewise. * pthread_support.c (do_blocking_enter, do_blocking_leave, GC_set_stackbottom, GC_call_with_gc_active): Likewise. * include/private/pthread_support.h (GC_Thread_Rep.thread_blocked): Remove field. * include/private/pthread_support.h (DO_BLOCKING): Define macro; copy comment from thread_blocked. * pthread_support.c (GC_new_thread): Do not use thread_blocked.
Diffstat (limited to 'pthread_stop_world.c')
-rw-r--r--pthread_stop_world.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/pthread_stop_world.c b/pthread_stop_world.c
index 9dd734a6..9053787d 100644
--- a/pthread_stop_world.c
+++ b/pthread_stop_world.c
@@ -644,7 +644,7 @@ STATIC void GC_restart_handler(int sig)
UNLOCK();
return;
}
- if ((t -> flags & FINISHED) != 0 || t -> thread_blocked) {
+ if ((t -> flags & (FINISHED | DO_BLOCKING)) != 0) {
t -> suspended_ext = TRUE;
/* Terminated but not joined yet, or in do-blocking state. */
UNLOCK();
@@ -770,7 +770,7 @@ GC_INNER void GC_push_all_stacks(void)
++nthreads;
traced_stack_sect = p -> traced_stack_sect;
if (THREAD_EQUAL(p -> id, self)) {
- GC_ASSERT(!p->thread_blocked);
+ GC_ASSERT((p -> flags & DO_BLOCKING) == 0);
# ifdef SPARC
lo = GC_save_regs_in_stack();
# else
@@ -841,7 +841,7 @@ GC_INNER void GC_push_all_stacks(void)
# endif
# ifdef E2K
if ((GC_stop_count & THREAD_RESTARTED) != 0
- && !p->thread_blocked
+ && (p -> flags & DO_BLOCKING) == 0
# ifdef GC_ENABLE_SUSPEND_THREAD
&& !p->suspended_ext
# endif
@@ -898,8 +898,7 @@ STATIC int GC_suspend_all(void)
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (p = GC_threads[i]; p != 0; p = p -> next) {
if (!THREAD_EQUAL(p -> id, self)) {
- if ((p -> flags & FINISHED) != 0) continue;
- if (p -> thread_blocked) /* Will wait */ continue;
+ if ((p -> flags & (FINISHED | DO_BLOCKING)) != 0) continue;
# ifndef GC_OPENBSD_UTHREADS
# ifdef GC_ENABLE_SUSPEND_THREAD
if (p -> suspended_ext) continue;
@@ -1232,8 +1231,7 @@ GC_INNER void GC_stop_world(void)
for (i = 0; i < THREAD_TABLE_SZ; i++) {
for (p = GC_threads[i]; p != NULL; p = p -> next) {
if (!THREAD_EQUAL(p -> id, self)) {
- if ((p -> flags & FINISHED) != 0) continue;
- if (p -> thread_blocked) continue;
+ if ((p -> flags & (FINISHED | DO_BLOCKING)) != 0) continue;
# ifndef GC_OPENBSD_UTHREADS
# ifdef GC_ENABLE_SUSPEND_THREAD
if (p -> suspended_ext) continue;