Otherwise, if THREAD_LOCAL_ALLOC, GC_remove_all_threads_but_me would
not find the current thread descriptor in GC_threads.
* pthread_support.c [CAN_HANDLE_FORK] (GC_atfork_prepare): Call GC_init
if not GC_is_initialized.
* win32_threads.c [CAN_HANDLE_FORK] (GC_atfork_prepare): Likewise.
/* Routines for fork handling by client (no-op if pthread_atfork works). */
GC_API void GC_CALL GC_atfork_prepare(void)
{
+ if (!EXPECT(GC_is_initialized, TRUE)) GC_init();
# if defined(GC_DARWIN_THREADS) && defined(MPROTECT_VDB)
if (GC_dirty_maintained) {
GC_ASSERT(0 == GC_handle_fork);
/* Routines for fork handling by client (no-op if pthread_atfork works). */
GC_API void GC_CALL GC_atfork_prepare(void)
{
+ if (!EXPECT(GC_is_initialized, TRUE)) GC_init();
if (GC_handle_fork <= 0)
fork_prepare_proc();
}