Initialize rpmalloc in profiler worker thread.

Thread local variables on gcc are apparently not initialized on thread
startup, but on first access to thread local variables block. Previously
it was working, because s_token was accessed before any rpmalloc
allocation could be performed. Now the first rpmalloc allocation is the
Socket class, and rpmalloc is not initialized there, as there was no
thread local access yet.
This commit is contained in:
Bartosz Taudul 2017-10-18 23:30:54 +02:00
parent c5eef172f1
commit 1e645665fe

View File

@ -154,6 +154,8 @@ enum { BulkSize = TargetFrameSize / QueueItemSize };
void Profiler::Worker() void Profiler::Worker()
{ {
rpmalloc_thread_initialize();
const auto procname = GetProcessName(); const auto procname = GetProcessName();
const auto pnsz = std::min<size_t>( strlen( procname ), WelcomeMessageProgramNameSize - 1 ); const auto pnsz = std::min<size_t>( strlen( procname ), WelcomeMessageProgramNameSize - 1 );