diff options
| author | Per Larsson <[email protected]> | 2021-12-16 10:49:03 +0100 |
|---|---|---|
| committer | Per Larsson <[email protected]> | 2021-12-16 10:49:03 +0100 |
| commit | 8888bc04fb8c9bca7b32d61f98bd437bbb4826c8 (patch) | |
| tree | 7568360f26a557cf6dc4482bef00bc33eaf6bbc2 /zencore/thread.cpp | |
| parent | A little better bundle task with trace support. (diff) | |
| parent | Use a CAS loop if atomic<Floating>::fetch_add() isn't available (diff) | |
| download | zen-8888bc04fb8c9bca7b32d61f98bd437bbb4826c8.tar.xz zen-8888bc04fb8c9bca7b32d61f98bd437bbb4826c8.zip | |
Merge branch 'main' of https://github.com/EpicGames/zen
Diffstat (limited to 'zencore/thread.cpp')
| -rw-r--r-- | zencore/thread.cpp | 8 |
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 } |