mirror of
https://github.com/pocoproject/poco.git
synced 2025-05-25 06:27:41 +02:00
Remove the need for a debug build or debugger when setting Win32 thread names.
This commit is contained in:
parent
29a9a2cf1d
commit
ee77d05ab5
@ -40,7 +40,7 @@
|
|||||||
#include <process.h>
|
#include <process.h>
|
||||||
|
|
||||||
|
|
||||||
#if defined(_DEBUG) && defined(POCO_WIN32_DEBUGGER_THREAD_NAMES)
|
#if defined(POCO_WIN32_DEBUGGER_THREAD_NAMES)
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@ -62,8 +62,6 @@ namespace
|
|||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
void setThreadName(DWORD dwThreadID, const char* threadName)
|
void setThreadName(DWORD dwThreadID, const char* threadName)
|
||||||
{
|
|
||||||
if (IsDebuggerPresent())
|
|
||||||
{
|
{
|
||||||
THREADNAME_INFO info;
|
THREADNAME_INFO info;
|
||||||
info.dwType = 0x1000;
|
info.dwType = 0x1000;
|
||||||
@ -80,7 +78,6 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -237,7 +234,7 @@ unsigned __stdcall ThreadImpl::runnableEntry(void* pThread)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
_currentThreadHolder.set(reinterpret_cast<ThreadImpl*>(pThread));
|
_currentThreadHolder.set(reinterpret_cast<ThreadImpl*>(pThread));
|
||||||
#if defined(_DEBUG) && defined(POCO_WIN32_DEBUGGER_THREAD_NAMES)
|
#if defined(POCO_WIN32_DEBUGGER_THREAD_NAMES)
|
||||||
setThreadName(-1, reinterpret_cast<Thread*>(pThread)->getName().c_str());
|
setThreadName(-1, reinterpret_cast<Thread*>(pThread)->getName().c_str());
|
||||||
#endif
|
#endif
|
||||||
try
|
try
|
||||||
@ -267,7 +264,7 @@ unsigned __stdcall ThreadImpl::callableEntry(void* pThread)
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
_currentThreadHolder.set(reinterpret_cast<ThreadImpl*>(pThread));
|
_currentThreadHolder.set(reinterpret_cast<ThreadImpl*>(pThread));
|
||||||
#if defined(_DEBUG) && defined(POCO_WIN32_DEBUGGER_THREAD_NAMES)
|
#if defined(POCO_WIN32_DEBUGGER_THREAD_NAMES)
|
||||||
setThreadName(-1, reinterpret_cast<Thread*>(pThread)->getName().c_str());
|
setThreadName(-1, reinterpret_cast<Thread*>(pThread)->getName().c_str());
|
||||||
#endif
|
#endif
|
||||||
try
|
try
|
||||||
|
Loading…
x
Reference in New Issue
Block a user