diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-09-22 09:29:29 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-09-22 16:05:32 +0300 |
commit | daa9f78eed24e9c34364db1447f141869dbdd9e2 (patch) | |
tree | 8e7c4548bedb65dd14cc4112204dea2ead3d0495 /win32_threads.c | |
parent | 3eb104fc78e27d88d3ff0f74651416ceb0a3bdce (diff) | |
download | bdwgc-daa9f78eed24e9c34364db1447f141869dbdd9e2.tar.gz |
Remove unreachable code in GC_lookup_pthread
(refactoring)
* win32_threads.c [GC_PTHREADS && !GC_NO_THREADS_DISCOVERY]
(GC_lookup_pthread): Remove unreachable code (because GC_PTHREADS
implies GC_NO_THREADS_DISCOVERY, as of now); add TODO to re-add the
code when threads discovery will be supported with pthreads.
Diffstat (limited to 'win32_threads.c')
-rw-r--r-- | win32_threads.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/win32_threads.c b/win32_threads.c index 61e57ded..671eb996 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -1070,24 +1070,10 @@ GC_API void * GC_CALL GC_get_my_stackbottom(struct GC_stack_base *sb) /* cannot be concurrently terminated. */ STATIC GC_thread GC_lookup_pthread(pthread_t id) { - GC_ASSERT(I_DONT_HOLD_LOCK()); -# ifndef GC_NO_THREADS_DISCOVERY - if (GC_win32_dll_threads) { - int i; - LONG my_max = GC_get_max_thread_index(); - - for (i = 0; i <= my_max && - (!AO_load_acquire(&dll_thread_table[i].tm.in_use) - || !THREAD_EQUAL(dll_thread_table[i].pthread_id, id)); - /* Must still be in_use, since nobody else can */ - /* store our thread_id. */ - i++) { - /* empty */ - } - return i <= my_max ? (GC_thread)(dll_thread_table + i) : NULL; - } else -# endif - /* else */ { + /* TODO: search in dll_thread_table instead when DllMain-based */ + /* thread registration is made compatible with pthreads (and */ + /* turned on). */ + /* We first try the cache. If that fails, we use a very slow */ /* approach. */ DWORD win32_id = GET_PTHREAD_MAP_CACHE(id); @@ -1111,7 +1097,6 @@ GC_API void * GC_CALL GC_get_my_stackbottom(struct GC_stack_base *sb) foundit: UNLOCK(); return p; - } } #endif /* GC_PTHREADS */ |