summaryrefslogtreecommitdiff
path: root/pthread_support.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-10-14 08:04:27 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-10-14 08:11:26 +0300
commit151c88b8142ec025faaba76d2d34e7a1d178acc9 (patch)
tree1b00be4da8b2fabc53b5f8511f4598190729218f /pthread_support.c
parent64f23949cb9853a97aa2e158320c2256e94020b8 (diff)
downloadbdwgc-151c88b8142ec025faaba76d2d34e7a1d178acc9.tar.gz
Remove main_pthread_id variable
(refactoring) * pthread_support.c (main_pthread_id): Remove static variable. * pthread_support.c (GC_register_altstack): Do not set main_pthread_id. * pthread_support.c (GC_thr_init): Do not use main_pthread_id; always copy values from main_normstack[_size], main_altstack[_size] variables to the relevant fields of t; add comment.
Diffstat (limited to 'pthread_support.c')
-rw-r--r--pthread_support.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/pthread_support.c b/pthread_support.c
index 893165a7..bde4cfa3 100644
--- a/pthread_support.c
+++ b/pthread_support.c
@@ -782,7 +782,6 @@ GC_API int GC_CALL GC_thread_is_registered(void)
return me != NULL;
}
-static thread_id_t main_pthread_id;
static void *main_normstack, *main_altstack;
static word main_normstack_size, main_altstack_size;
@@ -802,7 +801,6 @@ GC_API void GC_CALL GC_register_altstack(void *normstack,
me -> altstack_size = altstack_size;
} else {
/* This happens if we are called before GC_thr_init. */
- main_pthread_id = self;
main_normstack = normstack;
main_normstack_size = normstack_size;
main_altstack = altstack;
@@ -1378,12 +1376,12 @@ GC_INNER void GC_thr_init(void)
t -> stack_ptr = GC_approx_sp();
# endif
t -> flags = DETACHED | MAIN_THREAD;
- if (THREAD_EQUAL(self, main_pthread_id)) {
+
+ /* Copy the alt-stack information if set. */
t -> normstack = (ptr_t)main_normstack;
t -> normstack_size = main_normstack_size;
t -> altstack = (ptr_t)main_altstack;
t -> altstack_size = main_altstack_size;
- }
}
/* Set GC_nprocs and available_markers_m1. */