Init rpmalloc thread-local data when sending messages.

There was a possibility of having uninitialized TLS block there, if the first
thing done in a thread was sending a message.
This commit is contained in:
Bartosz Taudul 2021-01-27 02:14:23 +01:00
parent 9892407ff0
commit 6b276a1a64

View File

@ -291,7 +291,11 @@ public:
#ifdef TRACY_ON_DEMAND
if( !GetProfiler().IsConnected() ) return;
#endif
if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack );
if( callstack != 0 )
{
InitRPMallocThread();
tracy::GetProfiler().SendCallstack( callstack );
}
TracyLfqPrepare( callstack == 0 ? QueueType::Message : QueueType::MessageCallstack );
auto ptr = (char*)tracy_malloc( size );
@ -307,7 +311,11 @@ public:
#ifdef TRACY_ON_DEMAND
if( !GetProfiler().IsConnected() ) return;
#endif
if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack );
if( callstack != 0 )
{
InitRPMallocThread();
tracy::GetProfiler().SendCallstack( callstack );
}
TracyLfqPrepare( callstack == 0 ? QueueType::MessageLiteral : QueueType::MessageLiteralCallstack );
MemWrite( &item->messageLiteral.time, GetTime() );
@ -321,7 +329,11 @@ public:
#ifdef TRACY_ON_DEMAND
if( !GetProfiler().IsConnected() ) return;
#endif
if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack );
if( callstack != 0 )
{
InitRPMallocThread();
tracy::GetProfiler().SendCallstack( callstack );
}
TracyLfqPrepare( callstack == 0 ? QueueType::MessageColor : QueueType::MessageColorCallstack );
auto ptr = (char*)tracy_malloc( size );
@ -340,7 +352,11 @@ public:
#ifdef TRACY_ON_DEMAND
if( !GetProfiler().IsConnected() ) return;
#endif
if( callstack != 0 ) tracy::GetProfiler().SendCallstack( callstack );
if( callstack != 0 )
{
InitRPMallocThread();
tracy::GetProfiler().SendCallstack( callstack );
}
TracyLfqPrepare( callstack == 0 ? QueueType::MessageLiteralColor : QueueType::MessageLiteralColorCallstack );
MemWrite( &item->messageColorLiteral.time, GetTime() );