Use common queue clearing function.

This commit is contained in:
Bartosz Taudul 2018-12-21 18:12:26 +01:00
parent 331693d7f1
commit a4be9b51b0

View File

@ -1069,22 +1069,7 @@ void Profiler::Worker()
return;
}
while( s_queue.try_dequeue_bulk( token, m_itemBuf, BulkSize ) > 0 ) {}
bool lockHeld = true;
while( !m_serialLock.try_lock() )
{
if( m_shutdownManual.load( std::memory_order_relaxed ) )
{
lockHeld = false;
break;
}
}
m_serialQueue.swap( m_serialDequeue );
if( lockHeld )
{
m_serialLock.unlock();
}
m_serialDequeue.clear();
ClearQueues( token );
m_sock = listen.Accept();
if( m_sock )