1
0
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:
Bartosz Taudul 2017-10-15 13:26:05 +02:00
parent ca543f04e3
commit f156cd922b

View File

@ -69,13 +69,16 @@ 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 );
PWSTR tmp; if( hnd != 0 )
GetThreadDescription( hnd, &tmp );
auto ret = wcstombs( buf, tmp, 256 );
CloseHandle( hnd );
if( ret != 0 )
{ {
return buf; PWSTR tmp;
GetThreadDescription( hnd, &tmp );
auto ret = wcstombs( buf, tmp, 256 );
CloseHandle( hnd );
if( ret != 0 )
{
return buf;
}
} }
# endif # endif
#else #else