From 401ebd6f3dbfe4c89777cb579ed39e7ab6f7614b Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Mon, 20 Aug 2018 21:40:13 +0200 Subject: [PATCH] Use spin-lock in DequeueSerial. A thread freezed during crash processing may hold the lock and never release it. The old behavior would cause deadlock in such situation. The new one can be modified to work. Also, we don't want to use timed mutex. --- client/TracyProfiler.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index e0902549..bd4284dd 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -1129,8 +1129,9 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token ) Profiler::DequeueStatus Profiler::DequeueSerial() { { - std::lock_guard lock( m_serialLock ); + while( !m_serialLock.try_lock() ) {} m_serialQueue.swap( m_serialDequeue ); + m_serialLock.unlock(); } const auto sz = m_serialDequeue.size();