From: Ivan Maidanski Date: Thu, 25 Apr 2019 06:54:13 +0000 (+0300) Subject: Check real-symbols are already initialized in pthread_join/detach X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=83a945f9dc92cc180ba85927550b99ff68911758;p=gc Check real-symbols are already initialized in pthread_join/detach * pthread_support.c (ASSERT_SYMS_INITIALIZED): New macro (checks either GC_syms_initialized or parallel_initialized depending on GC_USE_DLOPEN_WRAP). * pthread_support.c [!SN_TARGET_ORBIS && !SN_TARGET_PSP2] (pthread_join, pthread_detach): Call ASSERT_SYMS_INITIALIZED() instead of INIT_REAL_SYMS(). --- diff --git a/pthread_support.c b/pthread_support.c index f33467e9..42650440 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -253,8 +253,10 @@ # define INIT_REAL_SYMS() if (EXPECT(GC_syms_initialized, TRUE)) {} \ else GC_init_real_syms() +# define ASSERT_SYMS_INITIALIZED() GC_ASSERT(GC_syms_initialized) #else # define INIT_REAL_SYMS() (void)0 +# define ASSERT_SYMS_INITIALIZED() GC_ASSERT(parallel_initialized) #endif static GC_bool parallel_initialized = FALSE; @@ -1555,7 +1557,7 @@ GC_INNER_PTHRSTART void GC_thread_exit_proc(void *arg) GC_thread t; DCL_LOCK_STATE; - INIT_REAL_SYMS(); + ASSERT_SYMS_INITIALIZED(); LOCK(); t = GC_lookup_thread(thread); /* This is guaranteed to be the intended one, since the thread id */ @@ -1591,7 +1593,7 @@ GC_INNER_PTHRSTART void GC_thread_exit_proc(void *arg) GC_thread t; DCL_LOCK_STATE; - INIT_REAL_SYMS(); + ASSERT_SYMS_INITIALIZED(); LOCK(); t = GC_lookup_thread(thread); UNLOCK();