Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit d6fb741

Browse files
committed
Change THREADSilentGetCurrentThreadId to return the pthread_threadid, which matches the tid from lldb
1 parent 2d384e4 commit d6fb741

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pal/src/include/pal/thread.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,14 @@ extern int free_threads_spinlock;
759759
linux we need to use gettid().
760760
761761
--*/
762-
#ifdef __LINUX__
762+
#if defined(__LINUX__)
763763
#define THREADSilentGetCurrentThreadId() (SIZE_T)syscall(SYS_gettid)
764+
#elif defined(__APPLE__)
765+
inline SIZE_T THREADSilentGetCurrentThreadId() {
766+
uint64_t tid;
767+
pthread_threadid_np(pthread_self(), &tid);
768+
return (SIZE_T)tid;
769+
}
764770
#else
765771
#define THREADSilentGetCurrentThreadId() (SIZE_T)pthread_self()
766772
#endif

0 commit comments

Comments
 (0)