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,
61
61
62
62
struct tr2tls_thread_ctx * tr2tls_get_self (void )
63
63
{
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 );
65
70
66
71
/*
67
72
* 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)
76
81
77
82
int tr2tls_is_main_thread (void )
78
83
{
79
- struct tr2tls_thread_ctx * ctx = pthread_getspecific (tr2tls_key );
84
+ if (!HAVE_THREADS )
85
+ return 1 ;
80
86
81
- return ctx == tr2tls_thread_main ;
87
+ return pthread_getspecific ( tr2tls_key ) == tr2tls_thread_main ;
82
88
}
83
89
84
90
void tr2tls_unset_self (void )
You can’t perform that action at this time.
0 commit comments