From b8cb5a63e65e17c5adb9f4fcccd615200662ced8 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Mon, 30 May 2022 23:38:44 +0300 Subject: Refine comments in code regarding DllMain-based threads registration * include/gc/gc.h (GC_use_threads_discovery): Refine comment (mention GC_register_my_thread and GC_init). * os_dep.c [MSWIN32 || MSWINCE] (GC_get_stack_base): Add comment about the GC lock. * win32_threads.c (GC_CreateThread): Add comment about GC_init_parallel if GC_win32_dll_threads set by GC_use_threads_discovery(). * win32_threads.c [!GC_PTHREADS && !GC_NO_THREADS_DISCOVERY] (GC_DllMain): Add more comments for DLL_THREAD_ATTACH case. --- win32_threads.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'win32_threads.c') diff --git a/win32_threads.c b/win32_threads.c index ee9e7375..204f60b0 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -2580,8 +2580,9 @@ GC_INNER void GC_get_next_stack(char *start, char *limit, if (!EXPECT(parallel_initialized, TRUE)) GC_init_parallel(); GC_ASSERT(GC_thr_initialized); - /* Make sure GC is initialized (i.e. main thread is */ - /* attached, tls is initialized). */ + /* Make sure GC is initialized (i.e. main thread is attached, */ + /* tls is initialized). This is redundant when */ + /* GC_win32_dll_threads is set by GC_use_threads_discovery(). */ # ifdef DEBUG_THREADS GC_log_printf("About to create a thread from 0x%lx\n", @@ -3150,11 +3151,12 @@ GC_INNER void GC_thr_init(void) if (!GC_win32_dll_threads && parallel_initialized) return TRUE; switch (reason) { - case DLL_THREAD_ATTACH: + case DLL_THREAD_ATTACH: /* invoked for threads other than main */ # ifdef PARALLEL_MARK /* Don't register marker threads. */ if (GC_parallel) { /* We could reach here only if parallel_initialized == FALSE. */ + /* Because GC_thr_init() sets GC_parallel to off. */ break; } # endif -- cgit v1.2.1