From bbbd526231063e62d32a2c72ef4d52df8273efd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Tue, 8 Sep 2015 20:57:10 -0700 Subject: [PATCH] Cleanup. --- include/bx/thread.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/bx/thread.h b/include/bx/thread.h index f10a91c..d6b2602 100644 --- a/include/bx/thread.h +++ b/include/bx/thread.h @@ -52,7 +52,7 @@ namespace bx } } - void init(ThreadFn _fn, void* _userData = NULL, uint32_t _stackSize = 0) + void init(ThreadFn _fn, void* _userData = NULL, uint32_t _stackSize = 0, const char* _name = NULL) { BX_CHECK(!m_running, "Already running!"); @@ -101,6 +101,10 @@ namespace bx BX_CHECK(0 == result, "pthread_attr_setschedparam failed! %d", result); #endif // BX_PLATFORM_ + if (NULL != _name) + { + setThreadName(_name); + } m_sem.wait(); } @@ -146,6 +150,7 @@ namespace bx #elif BX_PLATFORM_POSIX pthread_setname_np(m_handle, _name); #elif BX_PLATFORM_WINDOWS && BX_COMPILER_MSVC +# pragma pack(push, 8) struct ThreadName { DWORD type; @@ -153,6 +158,7 @@ namespace bx DWORD id; DWORD flags; }; +# pragma pack(pop) ThreadName tn; tn.type = 0x1000; tn.name = _name;