From 5ab192ee054724273ece9b7ca63bf31ac7130d13 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Mon, 29 Jun 2026 16:11:45 +0800 Subject: [PATCH] Common (Thread): adds `ffThreadGetCurrentId` --- src/common/thread.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/thread.h b/src/common/thread.h index 64d8478d9..84c247cae 100644 --- a/src/common/thread.h +++ b/src/common/thread.h @@ -4,7 +4,7 @@ #ifdef FF_HAVE_THREADS #if defined(_WIN32) - #include + #include "common/windows/nt.h" #include #include #include @@ -41,6 +41,9 @@ static inline bool ffThreadJoin(FFThreadType thread, uint32_t timeout) { } NtClose(thread); return true; +} +static inline uintptr_t ffThreadGetCurrentId() { + return (uintptr_t) ffGetTeb()->ClientId.UniqueThread; } #else #include @@ -104,6 +107,9 @@ static inline bool ffThreadJoin(FFThreadType thread, FF_A_UNUSED uint32_t timeou #endif pthread_join(thread, NULL); return true; +} +static inline uintptr_t ffThreadGetCurrentId() { + return (uintptr_t) pthread_self(); } #endif #else // FF_HAVE_THREADS