From 30267de474f775e112af63abd58f39458c1e5065 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 21 Oct 2025 20:41:22 +0200 Subject: [PATCH] Make sure symbols thread has time to enter into disconnected condition. --- public/client/TracyProfiler.cpp | 4 ++++ public/client/TracyProfiler.hpp | 1 + 2 files changed, 5 insertions(+) diff --git a/public/client/TracyProfiler.cpp b/public/client/TracyProfiler.cpp index c9057999..5916ce2d 100644 --- a/public/client/TracyProfiler.cpp +++ b/public/client/TracyProfiler.cpp @@ -1492,6 +1492,7 @@ Profiler::Profiler() , m_isConnected( false ) #ifdef TRACY_ON_DEMAND , m_connectionId( 0 ) + , m_symbolsBusy( false ) , m_deferredQueue( 64*1024 ) #endif , m_paramCallback( nullptr ) @@ -1977,6 +1978,8 @@ void Profiler::Worker() } #ifdef TRACY_ON_DEMAND + while( m_symbolsBusy.load( std::memory_order_acquire ) ) { YieldThread(); } + m_symbolsBusy.store( true, std::memory_order_release ); const auto currentTime = GetTime(); ClearQueues( token ); m_connectionId.fetch_add( 1, std::memory_order_release ); @@ -3623,6 +3626,7 @@ void Profiler::SymbolWorker() } while( m_symbolQueue.front() ) m_symbolQueue.pop(); std::this_thread::sleep_for( std::chrono::milliseconds( 20 ) ); + m_symbolsBusy.store( false, std::memory_order_release ); continue; } #endif diff --git a/public/client/TracyProfiler.hpp b/public/client/TracyProfiler.hpp index 81f0e5bd..aacfa16b 100644 --- a/public/client/TracyProfiler.hpp +++ b/public/client/TracyProfiler.hpp @@ -1043,6 +1043,7 @@ private: std::atomic m_isConnected; #ifdef TRACY_ON_DEMAND std::atomic m_connectionId; + std::atomic m_symbolsBusy; TracyMutex m_deferredLock; FastVector m_deferredQueue;