aboutsummaryrefslogtreecommitdiff
path: root/zencore/thread.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-10-25 10:26:39 +0200
committerMartin Ridgers <[email protected]>2021-10-25 22:50:43 +0200
commit8415b0f1b22f619b84516b4d9e164bf17f1c1e11 (patch)
tree473dc7dd23d700921292c5f9161dc0b060ca094f /zencore/thread.cpp
parentUse m_ShutdownEvent.Wait() in HttpNullServer::Run() on POSIX (diff)
downloadzen-8415b0f1b22f619b84516b4d9e164bf17f1c1e11.tar.xz
zen-8415b0f1b22f619b84516b4d9e164bf17f1c1e11.zip
pthread implementation for naming a thread
Diffstat (limited to 'zencore/thread.cpp')
-rw-r--r--zencore/thread.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/zencore/thread.cpp b/zencore/thread.cpp
index 2a38283e1..c20d10db3 100644
--- a/zencore/thread.cpp
+++ b/zencore/thread.cpp
@@ -9,6 +9,7 @@
#if ZEN_PLATFORM_WINDOWS
# include <zencore/windows.h>
#elif ZEN_PLATFORM_LINUX
+# include <pthread.h>
# include <unistd.h>
#endif
@@ -70,6 +71,8 @@ SetCurrentThreadName([[maybe_unused]] std::string_view ThreadName)
std::string ThreadNameZ{ThreadName};
SetNameInternal(GetCurrentThreadId(), ThreadNameZ.c_str());
#else
+ std::string ThreadNameZ{ThreadName};
+ pthread_setname_np(pthread_self(), ThreadNameZ.c_str());
#endif
} // namespace zen