From 52c9730542a141e152fc541cccac307b042489dc Mon Sep 17 00:00:00 2001 From: Carter Li Date: Fri, 3 Jul 2026 15:36:41 +0800 Subject: [PATCH] Tracer: query tid only when threading is enabled --- src/common/impl/tracer.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/common/impl/tracer.c b/src/common/impl/tracer.c index a2951598f..498294e9f 100644 --- a/src/common/impl/tracer.c +++ b/src/common/impl/tracer.c @@ -122,10 +122,14 @@ __attribute__((no_instrument_function)) static void write_event(void* this_fn, b } events[idx].ts = get_time_us(); -#if _WIN32 +#if ENABLE_THREADS + #if _WIN32 events[idx].tid = (uint64_t) GetCurrentThreadId(); -#else + #else events[idx].tid = (uint64_t) (uintptr_t) pthread_self(); + #endif +#else + events[idx].tid = 0; #endif events[idx].func = this_fn; if (is_exit) {