summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2022-05-30 23:14:29 +0300
committerIvan Maidanski <ivmai@mail.ru>2022-05-30 23:14:29 +0300
commit0c56f4381e52962cdad2ebfefe8aae280f5c95f6 (patch)
tree9196343f9bc3a65ae487fd557c0d309bb9228672
parent009b59a84bad832f2750947c02a10f521ff50ba6 (diff)
downloadbdwgc-0c56f4381e52962cdad2ebfefe8aae280f5c95f6.tar.gz
Fix abort in Win32 DllMain if PARALLEL_MARK
(fix of commit f1b257a66) Also, enable GC_use_threads_discovery() on Windows even in case of PARALLEL_MARK. * tests/gctest.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/gctest.c3
-rw-r--r--win32_threads.c4
2 files changed, 1 insertions, 6 deletions
diff --git a/tests/gctest.c b/tests/gctest.c
index f9c633e8..227b2446 100644
--- a/tests/gctest.c
+++ b/tests/gctest.c
@@ -2261,8 +2261,7 @@ DWORD __stdcall thr_window(void * arg GC_ATTR_UNUSED)
GC_noop1((GC_word)&WinMain);
# endif
# 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 75c8fcb4..ee9e7375 100644
--- a/win32_threads.c
+++ b/win32_threads.c
@@ -3163,9 +3163,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
@@ -3174,7 +3171,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;