From 6886d5035e411ece0db08bcb38cd404683ad2b26 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 10 Sep 2017 20:23:06 +0200 Subject: [PATCH] Dequeue events (and do nothing with them). --- client/TracyProfiler.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index e1840785..4bf3882f 100755 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -61,9 +61,22 @@ void Profiler::ZoneEnd( QueueZoneEnd&& data ) void Profiler::Worker() { + enum { BulkSize = 32 }; + moodycamel::ConsumerToken token( m_queue ); + for(;;) { if( m_shutdown.load( std::memory_order_relaxed ) ) return; + + QueueItem item[BulkSize]; + const auto sz = m_queue.try_dequeue_bulk( token, item, BulkSize ); + if( sz > 0 ) + { + } + else + { + std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) ); + } } }