diff options
-rw-r--r-- | include/gc/gc.h | 5 | ||||
-rw-r--r-- | os_dep.c | 1 | ||||
-rw-r--r-- | win32_threads.c | 8 |
3 files changed, 9 insertions, 5 deletions
diff --git a/include/gc/gc.h b/include/gc/gc.h index 390d911c..fcca1b2a 100644 --- a/include/gc/gc.h +++ b/include/gc/gc.h @@ -1517,8 +1517,9 @@ GC_API void GC_CALL GC_start_mark_threads(void); /* Use implicit thread registration and processing (via Win32 DllMain */ /* or Darwin task_threads). Deprecated. Must be called before */ /* GC_INIT() and other GC routines. Should be avoided if */ - /* GC_pthread_create, GC_beginthreadex (or GC_CreateThread) could be */ - /* called instead. Disables parallelized GC on Win32. */ + /* GC_pthread_create, GC_beginthreadex (or GC_CreateThread), or */ + /* GC_register_my_thread could be called instead. */ + /* Includes a GC_init() call. Disables parallelized GC on Win32. */ GC_API void GC_CALL GC_use_threads_discovery(void); #endif @@ -781,6 +781,7 @@ GC_INNER size_t GC_page_size = 0; return buf.RegionSize; } + /* Should not acquire the GC lock as it is used by GC_DllMain. */ GC_API int GC_CALL GC_get_stack_base(struct GC_stack_base *sb) { ptr_t trunc_sp; 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 |