Set the thread name when running under windbg or Visual Studio debugger.
git-svn-id: http://yate.null.ro/svn/yate/trunk@2755 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
4850f9077d
commit
259f204d39
|
@ -317,6 +317,24 @@ void ThreadPrivate::run()
|
|||
if (m_name)
|
||||
prctl(PR_SET_NAME,(unsigned long)m_name,0,0,0);
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _WINDOWS
|
||||
#ifndef NDEBUG
|
||||
if (m_name) {
|
||||
struct {
|
||||
DWORD dwType;
|
||||
LPCSTR szName;
|
||||
DWORD dwThreadID;
|
||||
DWORD dwFlags;
|
||||
} threadInfo;
|
||||
threadInfo.dwType = 0x1000;
|
||||
threadInfo.szName = m_name;
|
||||
threadInfo.dwThreadID = (DWORD)-1;
|
||||
threadInfo.dwFlags = 0;
|
||||
__try { RaiseException(0x406D1388, 0, sizeof(threadInfo)/sizeof(DWORD), (DWORD*)&threadInfo); }
|
||||
__except (EXCEPTION_CONTINUE_EXECUTION) { }
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// FIXME: possible race if public object is destroyed during thread startup
|
||||
|
|
Loading…
Reference in New Issue