mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Limit pthread thread name to 16 bytes.
This is a documented pthread restriction. Passing longer strings has no effect (i.e. thread name is not set).
This commit is contained in:
parent
21fd14397d
commit
bd622c304a
@ -48,7 +48,18 @@ void SetThreadName( std::thread& thread, const char* name )
|
||||
}
|
||||
# endif
|
||||
#else
|
||||
pthread_setname_np( thread.native_handle(), name );
|
||||
const auto sz = strlen( name );
|
||||
if( sz <= 15 )
|
||||
{
|
||||
pthread_setname_np( thread.native_handle(), name );
|
||||
}
|
||||
else
|
||||
{
|
||||
char buf[16];
|
||||
memcpy( buf, name, 15 );
|
||||
buf[15] = '\0';
|
||||
pthread_setname_np( thread.native_handle(), sz );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user