diff options
Diffstat (limited to 'zen/thread.h')
-rw-r--r-- | zen/thread.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/zen/thread.h b/zen/thread.h index bb6e7901..700d42dc 100644 --- a/zen/thread.h +++ b/zen/thread.h @@ -13,7 +13,7 @@ #include "type_traits.h" #include "optional.h" #ifdef ZEN_WIN -#include "win.h" + #include "win.h" #endif @@ -63,7 +63,7 @@ template <class Rep, class Period> void interruptibleSleep(const std::chrono::duration<Rep, Period>& relTime); //throw ThreadInterruption #ifdef ZEN_WIN -void setCurrentThreadName(const char* threadName); + void setCurrentThreadName(const char* threadName); #endif //------------------------------------------------------------------------------------------ @@ -421,10 +421,10 @@ void InterruptibleThread::interrupt() { intStatus_->interrupt(); } #pragma pack(push,8) struct THREADNAME_INFO { - 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. + 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. }; #pragma pack(pop) @@ -432,18 +432,18 @@ struct THREADNAME_INFO inline void setCurrentThreadName(const char* threadName) { -const DWORD MS_VC_EXCEPTION = 0x406D1388; - -THREADNAME_INFO info = {}; - info.dwType = 0x1000; - info.szName = threadName; - info.dwThreadID = GetCurrentThreadId(); - - __try - { - ::RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), reinterpret_cast<ULONG_PTR*>(&info)); - } - __except(EXCEPTION_EXECUTE_HANDLER){} + const DWORD MS_VC_EXCEPTION = 0x406D1388; + + THREADNAME_INFO info = {}; + info.dwType = 0x1000; + info.szName = threadName; + info.dwThreadID = GetCurrentThreadId(); + + __try + { + ::RaiseException(MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), reinterpret_cast<ULONG_PTR*>(&info)); + } + __except (EXCEPTION_EXECUTE_HANDLER) {} } #endif } |