summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/thread.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/common/thread.cpp b/src/common/thread.cpp
index 4bcb65236..5144c0d9f 100644
--- a/src/common/thread.cpp
+++ b/src/common/thread.cpp
@@ -45,7 +45,7 @@ void SwitchCurrentThread() {
45 45
46// This is implemented much nicer in upcoming msvc++, see: 46// This is implemented much nicer in upcoming msvc++, see:
47// http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.100).aspx 47// http://msdn.microsoft.com/en-us/library/xcb2z8hs(VS.100).aspx
48void SetCurrentThreadName(const char* szThreadName) { 48void SetCurrentThreadName(const char* name) {
49 static const DWORD MS_VC_EXCEPTION = 0x406D1388; 49 static const DWORD MS_VC_EXCEPTION = 0x406D1388;
50 50
51#pragma pack(push, 8) 51#pragma pack(push, 8)
@@ -58,7 +58,7 @@ void SetCurrentThreadName(const char* szThreadName) {
58#pragma pack(pop) 58#pragma pack(pop)
59 59
60 info.dwType = 0x1000; 60 info.dwType = 0x1000;
61 info.szName = szThreadName; 61 info.szName = name;
62 info.dwThreadID = -1; // dwThreadID; 62 info.dwThreadID = -1; // dwThreadID;
63 info.dwFlags = 0; 63 info.dwFlags = 0;
64 64
@@ -97,15 +97,15 @@ void SwitchCurrentThread() {
97 97
98// MinGW with the POSIX threading model does not support pthread_setname_np 98// MinGW with the POSIX threading model does not support pthread_setname_np
99#if !defined(_WIN32) || defined(_MSC_VER) 99#if !defined(_WIN32) || defined(_MSC_VER)
100void SetCurrentThreadName(const char* szThreadName) { 100void SetCurrentThreadName(const char* name) {
101#ifdef __APPLE__ 101#ifdef __APPLE__
102 pthread_setname_np(szThreadName); 102 pthread_setname_np(name);
103#elif defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__) 103#elif defined(__Bitrig__) || defined(__DragonFly__) || defined(__FreeBSD__) || defined(__OpenBSD__)
104 pthread_set_name_np(pthread_self(), szThreadName); 104 pthread_set_name_np(pthread_self(), name);
105#elif defined(__NetBSD__) 105#elif defined(__NetBSD__)
106 pthread_setname_np(pthread_self(), "%s", (void*)szThreadName); 106 pthread_setname_np(pthread_self(), "%s", (void*)name);
107#else 107#else
108 pthread_setname_np(pthread_self(), szThreadName); 108 pthread_setname_np(pthread_self(), name);
109#endif 109#endif
110} 110}
111#endif 111#endif