mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
OpenThread may fail.
This commit is contained in:
parent
ca543f04e3
commit
f156cd922b
@ -69,6 +69,8 @@ const char* GetThreadName( uint64_t id )
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# ifdef NTDDI_WIN10_RS2
|
# ifdef NTDDI_WIN10_RS2
|
||||||
auto hnd = OpenThread( THREAD_QUERY_LIMITED_INFORMATION, FALSE, (DWORD)id );
|
auto hnd = OpenThread( THREAD_QUERY_LIMITED_INFORMATION, FALSE, (DWORD)id );
|
||||||
|
if( hnd != 0 )
|
||||||
|
{
|
||||||
PWSTR tmp;
|
PWSTR tmp;
|
||||||
GetThreadDescription( hnd, &tmp );
|
GetThreadDescription( hnd, &tmp );
|
||||||
auto ret = wcstombs( buf, tmp, 256 );
|
auto ret = wcstombs( buf, tmp, 256 );
|
||||||
@ -77,6 +79,7 @@ const char* GetThreadName( uint64_t id )
|
|||||||
{
|
{
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
if( pthread_getname_np( (pthread_t)id, buf, 256 ) == 0 )
|
if( pthread_getname_np( (pthread_t)id, buf, 256 ) == 0 )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user