Initialize rpmalloc in SetThreadName().

There's no guarantee that rpmalloc will be initialized when the thread
calls SetThreadName, due to thread_local storage initialization rules.
This commit is contained in:
Bartosz Taudul 2018-03-30 14:39:25 +02:00
parent 045870ad95
commit 813e265bc3

View File

@ -84,6 +84,7 @@ void SetThreadName( std::thread::native_handle_type handle, const char* name )
#endif
#ifdef TRACY_COLLECT_THREAD_NAMES
{
rpmalloc_thread_initialize();
const auto sz = strlen( name );
char* buf = (char*)tracy_malloc( sz+1 );
memcpy( buf, name, sz );