mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 08:54:34 +00:00
pthread_setname_np takes 1 arg on macOS
pthread_setname_np() can only set the name of the current thread on macOS, so only pass a single name argument. Fixes build break on macOS 12.2 with _GNU_SOURCE defined.
This commit is contained in:
parent
6c33a23390
commit
31e4bef135
@ -155,14 +155,22 @@ TRACY_API void SetThreadName( const char* name )
|
|||||||
const auto sz = strlen( name );
|
const auto sz = strlen( name );
|
||||||
if( sz <= 15 )
|
if( sz <= 15 )
|
||||||
{
|
{
|
||||||
|
#if defined __APPLE__
|
||||||
|
pthread_setname_np( name );
|
||||||
|
#else
|
||||||
pthread_setname_np( pthread_self(), name );
|
pthread_setname_np( pthread_self(), name );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char buf[16];
|
char buf[16];
|
||||||
memcpy( buf, name, 15 );
|
memcpy( buf, name, 15 );
|
||||||
buf[15] = '\0';
|
buf[15] = '\0';
|
||||||
|
#if defined __APPLE__
|
||||||
|
pthread_setname_np( buf );
|
||||||
|
#else
|
||||||
pthread_setname_np( pthread_self(), buf );
|
pthread_setname_np( pthread_self(), buf );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user