mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 10:56:58 +02:00
graphics: cache the macOS thread id in TrackingSpinLock (#1169)
Every lock and unlock called pthread_mach_thread_np. Cache it per thread like the Linux branch does.
This commit is contained in:
@@ -60,7 +60,9 @@ private:
|
|||||||
return GetCurrentThreadId();
|
return GetCurrentThreadId();
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
// mach thread port is a nonzero per-thread id (0 is the "no owner" sentinel).
|
// mach thread port is a nonzero per-thread id (0 is the "no owner" sentinel).
|
||||||
return static_cast<uint32_t>(pthread_mach_thread_np(pthread_self()));
|
static thread_local const uint32_t tid =
|
||||||
|
static_cast<uint32_t>(pthread_mach_thread_np(pthread_self()));
|
||||||
|
return tid;
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
static thread_local const uint32_t tid = static_cast<uint32_t>(::syscall(SYS_gettid));
|
static thread_local const uint32_t tid = static_cast<uint32_t>(::syscall(SYS_gettid));
|
||||||
return tid;
|
return tid;
|
||||||
|
|||||||
Reference in New Issue
Block a user