mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 05:03:53 +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
|
# endif
|
||||||
#else
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user