diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-10-06 21:03:41 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-10-06 21:06:22 +0300 |
commit | bbe909230a79d53af2bc3fde28f0ee9fa03c1bb9 (patch) | |
tree | 97829049467a1b1eada5fae2c41c7033ce7bea45 | |
parent | 6b2980ab6e8f0a1dbd176eb546cdf4aba8172092 (diff) | |
download | bdwgc-bbe909230a79d53af2bc3fde28f0ee9fa03c1bb9.tar.gz |
Remove GC_mark_threads variable
(refactoring)
* pthread_support.c [PARALLEL_MARK] (GC_mark_threads): Remove static
variable.
* pthread_support.c [PARALLEL_MARK] (GC_start_mark_threads_inner):
Define new_thread local variable and use it in pthread_create() call
instead of GC_mark_threads.
* win32_threads.c [PARALLEL_MARK]: Remove comment about
GC_mark_threads.
-rw-r--r-- | pthread_support.c | 8 | ||||
-rw-r--r-- | win32_threads.c | 2 |
2 files changed, 4 insertions, 6 deletions
diff --git a/pthread_support.c b/pthread_support.c index 3d8a928b..7bf782fd 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -418,8 +418,6 @@ STATIC void * GC_mark_thread(void * id) } } -STATIC pthread_t GC_mark_threads[MAX_MARKERS]; - #ifdef GLIBC_2_1_MUTEX_HACK /* Ugly workaround for a linux threads bug in the final versions */ /* of glibc2.1. Pthread_mutex_trylock sets the mutex owner */ @@ -521,8 +519,10 @@ GC_INNER void GC_start_mark_threads_inner(void) GC_markers_m1 = available_markers_m1; for (i = 0; i < available_markers_m1; ++i) { - if (0 != REAL_FUNC(pthread_create)(GC_mark_threads + i, &attr, - GC_mark_thread, (void *)(word)i)) { + pthread_t new_thread; + + if (REAL_FUNC(pthread_create)(&new_thread, &attr, GC_mark_thread, + (void *)(word)i) != 0) { WARN("Marker thread %" WARN_PRIdPTR " creation failed\n", i); /* Don't try to create other marker threads. */ GC_markers_m1 = i; diff --git a/win32_threads.c b/win32_threads.c index 3e5cdaf0..a45bddc8 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1936,8 +1936,6 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, # define UNSET_MARK_LOCK_HOLDER (void)0 # endif - /* GC_mark_threads[] is unused here unlike that in pthread_support.c */ - static int available_markers_m1 = 0; # ifdef GC_PTHREADS_PARAMARK |