File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,12 @@ struct tr2tls_thread_ctx *tr2tls_create_self(const char *thread_name,
6161
6262struct tr2tls_thread_ctx * tr2tls_get_self (void )
6363{
64- struct tr2tls_thread_ctx * ctx = pthread_getspecific (tr2tls_key );
64+ struct tr2tls_thread_ctx * ctx ;
65+
66+ if (!HAVE_THREADS )
67+ return tr2tls_thread_main ;
68+
69+ ctx = pthread_getspecific (tr2tls_key );
6570
6671 /*
6772 * If the thread-proc did not call trace2_thread_start(), we won't
@@ -76,9 +81,10 @@ struct tr2tls_thread_ctx *tr2tls_get_self(void)
7681
7782int tr2tls_is_main_thread (void )
7883{
79- struct tr2tls_thread_ctx * ctx = pthread_getspecific (tr2tls_key );
84+ if (!HAVE_THREADS )
85+ return 1 ;
8086
81- return ctx == tr2tls_thread_main ;
87+ return pthread_getspecific ( tr2tls_key ) == tr2tls_thread_main ;
8288}
8389
8490void tr2tls_unset_self (void )
You can’t perform that action at this time.
0 commit comments