aboutsummaryrefslogtreecommitdiff
path: root/zencore/thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zencore/thread.cpp')
-rw-r--r--zencore/thread.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/zencore/thread.cpp b/zencore/thread.cpp
index 6d17e6968..8fe25b528 100644
--- a/zencore/thread.cpp
+++ b/zencore/thread.cpp
@@ -88,8 +88,12 @@ SetCurrentThreadName([[maybe_unused]] std::string_view ThreadName)
SetNameInternal(GetCurrentThreadId(), ThreadNameZ.c_str());
#else
std::string ThreadNameZ{ThreadName};
+#if ZEN_PLATFORM_MAC
+ pthread_setname_np(ThreadNameZ.c_str());
+#else
pthread_setname_np(pthread_self(), ThreadNameZ.c_str());
#endif
+#endif
} // namespace zen
void
@@ -1037,8 +1041,10 @@ GetCurrentThreadId()
{
#if ZEN_PLATFORM_WINDOWS
return ::GetCurrentThreadId();
-#else
+#elif ZEN_PLATFORM_LINUX
return int(gettid());
+#elif ZEN_PLATFORM_MAC
+ return int(pthread_mach_thread_np(pthread_self()));
#endif
}