Prevent accesing TLS data twice on gcc.

This commit is contained in:
Bartosz Taudul 2017-10-03 16:55:04 +02:00
parent d1edd30ca6
commit b1aa16763b
2 changed files with 15 additions and 13 deletions

View File

@ -70,17 +70,15 @@ public:
#endif
}
static tracy_force_inline QueueItem* StartItem( Magic& magic ) { return s_queue.enqueue_begin( s_token, magic ); }
static tracy_force_inline void FinishItem( Magic magic ) { s_queue.enqueue_finish( s_token, magic ); }
static tracy_force_inline void FrameMark()
{
int8_t cpu;
Magic magic;
auto item = s_queue.enqueue_begin( s_token, magic );
auto& token = s_token;
auto item = s_queue.enqueue_begin( token, magic );
item->hdr.type = QueueType::FrameMarkMsg;
item->frameMark.time = GetTime( cpu );
s_queue.enqueue_finish( s_token, magic );
s_queue.enqueue_finish( token, magic );
}
static bool ShouldExit();

View File

@ -18,22 +18,24 @@ public:
const auto thread = GetThreadHandle();
m_thread = thread;
Magic magic;
auto item = Profiler::StartItem( magic );
auto& token = s_token;
auto item = s_queue.enqueue_begin( token, magic );
item->hdr.type = QueueType::ZoneBegin;
item->zoneBegin.time = Profiler::GetTime( item->zoneBegin.cpu );
item->zoneBegin.thread = thread;
item->zoneBegin.srcloc = (uint64_t)srcloc;
Profiler::FinishItem( magic );
s_queue.enqueue_finish( token, magic );
}
tracy_force_inline ~ScopedZone()
{
Magic magic;
auto item = Profiler::StartItem( magic );
auto& token = s_token;
auto item = s_queue.enqueue_begin( token, magic );
item->hdr.type = QueueType::ZoneEnd;
item->zoneEnd.time = Profiler::GetTime( item->zoneEnd.cpu );
item->zoneEnd.thread = m_thread;
Profiler::FinishItem( magic );
s_queue.enqueue_finish( token, magic );
}
tracy_force_inline void Text( const char* txt, size_t size )
@ -42,21 +44,23 @@ public:
auto ptr = new char[size+1];
memcpy( ptr, txt, size );
ptr[size] = '\0';
auto item = Profiler::StartItem( magic );
auto& token = s_token;
auto item = s_queue.enqueue_begin( token, magic );
item->hdr.type = QueueType::ZoneText;
item->zoneText.thread = m_thread;
item->zoneText.text = (uint64_t)ptr;
Profiler::FinishItem( magic );
s_queue.enqueue_finish( token, magic );
}
tracy_force_inline void Name( const char* name )
{
Magic magic;
auto item = Profiler::StartItem( magic );
auto& token = s_token;
auto item = s_queue.enqueue_begin( token, magic );
item->hdr.type = QueueType::ZoneName;
item->zoneName.thread = m_thread;
item->zoneName.name = (uint64_t)name;
Profiler::FinishItem( magic );
s_queue.enqueue_finish( token, magic );
}
private: