diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index cccb99bd..38b9086f 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -1222,13 +1222,26 @@ void Profiler::ClearQueues( moodycamel::ConsumerToken& token ) for( size_t i=0; i lock( m_serialLock ); + { + bool lockHeld = true; + while( !m_serialLock.try_lock() ) + { + if( m_shutdownManual.load( std::memory_order_relaxed ) ) + { + lockHeld = false; + break; + } + } + for( auto& v : m_serialQueue ) FreeAssociatedMemory( v ); + m_serialQueue.clear(); + if( lockHeld ) + { + m_serialLock.unlock(); + } + } for( auto& v : m_serialDequeue ) FreeAssociatedMemory( v ); m_serialDequeue.clear(); - - for( auto& v : m_serialQueue ) FreeAssociatedMemory( v ); - m_serialQueue.clear(); } Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )