From ce3574cf7ff2ee68608b4d001f5a6dd1e36b2252 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Wed, 16 Mar 2016 21:32:07 +0100 Subject: 7.7 --- zen/thread.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'zen/thread.h') 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 void interruptibleSleep(const std::chrono::duration& 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(&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(&info)); + } + __except (EXCEPTION_EXECUTE_HANDLER) {} } #endif } -- cgit