]> granicus.if.org Git - gc/commitdiff
Check real-symbols are already initialized in pthread_join/detach
authorIvan Maidanski <ivmai@mail.ru>
Thu, 25 Apr 2019 06:54:13 +0000 (09:54 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 25 Apr 2019 06:54:13 +0000 (09:54 +0300)
* 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().

pthread_support.c

index f33467e90e8034c6fdd73b4e596ea02fe8aec7b9..4265044053a1d116655a8395495667530db1f8c0 100644 (file)
 
 # 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();