diff options
author | Daniel Wilhelm <daniel@wili.li> | 2016-03-16 21:32:07 +0100 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2016-03-16 21:32:07 +0100 |
commit | ce3574cf7ff2ee68608b4d001f5a6dd1e36b2252 (patch) | |
tree | 576b1741351e1cd34f0fcce49f98df9c17e10912 /zen/thread.h | |
parent | 7.6 (diff) | |
download | FreeFileSync-ce3574cf7ff2ee68608b4d001f5a6dd1e36b2252.tar.gz FreeFileSync-ce3574cf7ff2ee68608b4d001f5a6dd1e36b2252.tar.bz2 FreeFileSync-ce3574cf7ff2ee68608b4d001f5a6dd1e36b2252.zip |
7.7
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 } |