Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-05-30 20:50:44 +0300
committerJunio C Hamano <gitster@pobox.com>2019-05-30 20:50:45 +0300
commit90f2d88e61e9e66d9813353cc0910598ebf8cb03 (patch)
tree84e2d8f5277b7c58e29c61d9c3ce01f354216cb8 /trace2/tr2_tls.c
parent20aa7c594fbc2e36476daae2f53d7c020306c62c (diff)
parent5fdae9d3be45ce17e22b5f7a742cae3dfe687516 (diff)
Merge branch 'jh/trace2'
* jh/trace2: trace2: fix tracing when NO_PTHREADS is defined
Diffstat (limited to 'trace2/tr2_tls.c')
-rw-r--r--trace2/tr2_tls.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/trace2/tr2_tls.c b/trace2/tr2_tls.c
index e76d8c5d92..067c23755f 100644
--- a/trace2/tr2_tls.c
+++ b/trace2/tr2_tls.c
@@ -61,7 +61,12 @@ struct tr2tls_thread_ctx *tr2tls_create_self(const char *thread_name,
struct tr2tls_thread_ctx *tr2tls_get_self(void)
{
- struct tr2tls_thread_ctx *ctx = pthread_getspecific(tr2tls_key);
+ struct tr2tls_thread_ctx *ctx;
+
+ if (!HAVE_THREADS)
+ return tr2tls_thread_main;
+
+ ctx = pthread_getspecific(tr2tls_key);
/*
* 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)
int tr2tls_is_main_thread(void)
{
- struct tr2tls_thread_ctx *ctx = pthread_getspecific(tr2tls_key);
+ if (!HAVE_THREADS)
+ return 1;
- return ctx == tr2tls_thread_main;
+ return pthread_getspecific(tr2tls_key) == tr2tls_thread_main;
}
void tr2tls_unset_self(void)