Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
trace2: fix tracing when NO_PTHREADS is defined
author
Jeff Hostetler
<jeffhost@microsoft.com>
Tue, 21 May 2019 19:33:59 +0000
(12:33 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Tue, 28 May 2019 17:52:34 +0000
(10:52 -0700)
Teach trace2 TLS code to not rely on pthread_getspecific() when NO_PTHREADS
is defined. Instead, always assume the context data of the main thread.
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
trace2/tr2_tls.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
c173542
)
diff --git
a/trace2/tr2_tls.c
b/trace2/tr2_tls.c
index 8e65b0361dbedb7360d3d0f30229875faf5088d4..e0c4529f73c3577e58a4f2c70e289b732720e649 100644
(file)
--- a/
trace2/tr2_tls.c
+++ b/
trace2/tr2_tls.c
@@
-47,7
+47,12
@@
struct tr2tls_thread_ctx *tr2tls_create_self(const char *thread_name)
struct tr2tls_thread_ctx *tr2tls_get_self(void)
{
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
/*
* If the thread-proc did not call trace2_thread_start(), we won't
@@
-62,9
+67,10
@@
struct tr2tls_thread_ctx *tr2tls_get_self(void)
int tr2tls_is_main_thread(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)
}
void tr2tls_unset_self(void)