diff options
Diffstat (limited to 'common/threads.cpp')
-rw-r--r-- | common/threads.cpp | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/common/threads.cpp b/common/threads.cpp index c1d9e8b0..c176f5af 100644 --- a/common/threads.cpp +++ b/common/threads.cpp @@ -32,37 +32,6 @@ #include <limits> -void althrd_setname(const char *name) -{ -#if defined(_MSC_VER) && !defined(_M_ARM) - -#define MS_VC_EXCEPTION 0x406D1388 -#pragma pack(push,8) - struct { - DWORD dwType; // Must be 0x1000. - LPCSTR szName; // Pointer to name (in user addr space). - DWORD dwThreadID; // Thread ID (-1=caller thread). - DWORD dwFlags; // Reserved for future use, must be zero. - } info; -#pragma pack(pop) - info.dwType = 0x1000; - info.szName = name; - info.dwThreadID = ~DWORD{0}; - info.dwFlags = 0; - - __try { - RaiseException(MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR), (ULONG_PTR*)&info); - } - __except(EXCEPTION_CONTINUE_EXECUTION) { - } -#undef MS_VC_EXCEPTION - -#else - - (void)name; -#endif -} - namespace al { semaphore::semaphore(unsigned int initial) @@ -93,41 +62,6 @@ bool semaphore::try_wait() noexcept #else -#include <pthread.h> -#ifdef HAVE_PTHREAD_NP_H -#include <pthread_np.h> -#endif - -namespace { - -using setname_t1 = int(*)(const char*); -using setname_t2 = int(*)(pthread_t, const char*); -using setname_t3 = void(*)(pthread_t, const char*); -using setname_t4 = int(*)(pthread_t, const char*, void*); - -[[maybe_unused]] void setname_caller(setname_t1 func, const char *name) -{ func(name); } - -[[maybe_unused]] void setname_caller(setname_t2 func, const char *name) -{ func(pthread_self(), name); } - -[[maybe_unused]] void setname_caller(setname_t3 func, const char *name) -{ func(pthread_self(), name); } - -[[maybe_unused]] void setname_caller(setname_t4 func, const char *name) -{ func(pthread_self(), "%s", static_cast<void*>(const_cast<char*>(name))); } - -} // namespace - -void althrd_setname(const char *name [[maybe_unused]]) -{ -#if defined(HAVE_PTHREAD_SET_NAME_NP) - setname_caller(pthread_set_name_np, name); -#elif defined(HAVE_PTHREAD_SETNAME_NP) - setname_caller(pthread_setname_np, name); -#endif -} - /* Do not try using libdispatch on systems where it is absent. */ #if defined(AL_APPLE_HAVE_DISPATCH) |