diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2022-05-30 23:14:29 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2022-06-17 00:27:36 +0300 |
commit | 004c424b28df65ee8583bf58c5a14a6136f6b011 (patch) | |
tree | d564486f805067b997e9373b0373e6c987a9e6fa | |
parent | e937951389ad23860c27d62be460f90d5b92e97a (diff) | |
download | bdwgc-004c424b28df65ee8583bf58c5a14a6136f6b011.tar.gz |
Fix abort in Win32 DllMain if PARALLEL_MARK
(a cherry-pick of commit 0c56f4381 from 'master')
Also, enable GC_use_threads_discovery() on Windows even in case
of PARALLEL_MARK.
* tests/test.c [GC_WIN32_THREADS && !GC_PTHREADS && GC_DLL
&& !GC_NO_THREADS_DISCOVERY && !MSWINCE && !THREAD_LOCAL_ALLOC]
(WinMain): Call GC_use_threads_discovery() regardless of PARALLEL_MARK.
* win32_threads.c [!GC_PTHREADS && !GC_NO_THREADS_DISCOVERY
&& PARALLEL_MARK] (GC_DllMain): Do not abort if DLL_PROCESS_ATTACH or
DLL_THREAD_ATTACH (call GC_register_my_thread_inner instead).
-rw-r--r-- | tests/test.c | 3 | ||||
-rw-r--r-- | win32_threads.c | 4 |
2 files changed, 1 insertions, 6 deletions
diff --git a/tests/test.c b/tests/test.c index a6085028..1d7983e9 100644 --- a/tests/test.c +++ b/tests/test.c @@ -1815,8 +1815,7 @@ int APIENTRY WinMain(HINSTANCE instance GC_ATTR_UNUSED, # endif DWORD thread_id; # if defined(GC_DLL) && !defined(GC_NO_THREADS_DISCOVERY) \ - && !defined(MSWINCE) && !defined(THREAD_LOCAL_ALLOC) \ - && !defined(PARALLEL_MARK) + && !defined(MSWINCE) && !defined(THREAD_LOCAL_ALLOC) GC_use_threads_discovery(); /* Test with implicit thread registration if possible. */ GC_printf("Using DllMain to track threads\n"); diff --git a/win32_threads.c b/win32_threads.c index a5d5cb93..7181b703 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -2915,9 +2915,6 @@ GC_INNER void GC_thr_init(void) /* This may run with the collector uninitialized. */ thread_id = GetCurrentThreadId(); if (parallel_initialized && GC_main_thread != thread_id) { -# ifdef PARALLEL_MARK - ABORT("Cannot initialize parallel marker from DllMain"); -# else struct GC_stack_base sb; /* Don't lock here. */ # ifdef GC_ASSERTIONS @@ -2926,7 +2923,6 @@ GC_INNER void GC_thr_init(void) GC_get_stack_base(&sb); GC_ASSERT(sb_result == GC_SUCCESS); GC_register_my_thread_inner(&sb, thread_id); -# endif } /* o.w. we already did it during GC_thr_init, called by GC_init */ break; |