Don't report CPU topology if delayed init is active.

Reporting topology requires producer to be available, which creates a
deadlock during delayed init data structures construction.

Calling GetProducer() results in a call to GetProfilerThreadData(),
which in turn calls GetProfilerData() to construct its thread local
variable. However, at this point we already are calling
GetProfilerData() (to construct the profiler itself). This would result
in an incorrect double construction of data, but the code already
prevents this by allowing init code to be entered only once. Hence the
deadlock.

Currently this is a non-issue, as no platform which can report CPU
topology needs to use delayed init.
This commit is contained in:
Bartosz Taudul 2020-01-02 22:39:05 +01:00
parent d272e19bfa
commit 25082b2bec

View File

@ -2450,6 +2450,7 @@ void Profiler::CalibrateDelay()
void Profiler::ReportTopology()
{
#ifndef TRACY_DELAYED_INIT
struct CpuData
{
uint32_t package;
@ -2592,6 +2593,7 @@ void Profiler::ReportTopology()
tracy_free( cpuData );
#endif
#endif
}
void Profiler::SendCallstack( int depth, const char* skipBefore )