mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Fix thread ids on osx, iphone.
This commit is contained in:
parent
3659afac2a
commit
1d9542ea25
@ -91,6 +91,8 @@ void SetThreadName( std::thread::native_handle_type handle, const char* name )
|
||||
auto data = (ThreadNameData*)tracy_malloc( sizeof( ThreadNameData ) );
|
||||
# ifdef _WIN32
|
||||
data->id = GetThreadId( static_cast<HANDLE>( handle ) );
|
||||
# elif defined __MACOSX__ || defined __IPHONE__
|
||||
pthread_thread_id( handle, data->id );
|
||||
# else
|
||||
data->id = (uint64_t)handle;
|
||||
# endif
|
||||
|
@ -24,6 +24,10 @@ static inline uint64_t GetThreadHandle()
|
||||
#ifdef _WIN32
|
||||
static_assert( sizeof( decltype( GetCurrentThreadId() ) ) <= sizeof( uint64_t ), "Thread handle too big to fit in protocol" );
|
||||
return uint64_t( GetCurrentThreadId() );
|
||||
#elif defined __MACOSX__ || defined __IPHONE__
|
||||
uint64_t id;
|
||||
pthread_threadid_np( pthread_self(), id );
|
||||
return id;
|
||||
#else
|
||||
static_assert( sizeof( decltype( pthread_self() ) ) <= sizeof( uint64_t ), "Thread handle too big to fit in protocol" );
|
||||
return uint64_t( pthread_self() );
|
||||
|
Loading…
Reference in New Issue
Block a user