1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

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.
This commit is contained in:
Bartosz Taudul 2018-08-20 21:40:13 +02:00
parent afee61a2cf
commit 401ebd6f3d

View File

@ -1129,8 +1129,9 @@ Profiler::DequeueStatus Profiler::Dequeue( moodycamel::ConsumerToken& token )
Profiler::DequeueStatus Profiler::DequeueSerial()
{
{
std::lock_guard<TracyMutex> lock( m_serialLock );
while( !m_serialLock.try_lock() ) {}
m_serialQueue.swap( m_serialDequeue );
m_serialLock.unlock();
}
const auto sz = m_serialDequeue.size();