From d942b7edf10aca3209c210d8a928e2cb44c3bdd8 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Tue, 17 Oct 2017 22:02:47 +0200 Subject: [PATCH] Don't exit until all data is sent. --- client/TracyProfiler.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index bc5837bd..9edcd415 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -192,8 +192,6 @@ void Profiler::Worker() for(;;) { - if( ShouldExit() ) return; - QueueItem item[BulkSize]; const auto sz = s_queue.try_dequeue_bulk( token, item, BulkSize ); if( sz > 0 ) @@ -212,6 +210,7 @@ void Profiler::Worker() } else { + if( ShouldExit() ) return; std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) ); } @@ -277,6 +276,8 @@ void Profiler::SendSourceLocation( uint64_t ptr ) s_token.ptr->enqueue( std::move( item ) ); } +static bool DontExit() { return false; } + bool Profiler::HandleServerQuery() { timeval tv; @@ -284,10 +285,10 @@ bool Profiler::HandleServerQuery() tv.tv_usec = 10000; uint8_t type; - if( !m_sock->Read( &type, sizeof( type ), &tv, ShouldExit ) ) return false; + if( !m_sock->Read( &type, sizeof( type ), &tv, DontExit ) ) return false; uint64_t ptr; - if( !m_sock->Read( &ptr, sizeof( ptr ), &tv, ShouldExit ) ) return false; + if( !m_sock->Read( &ptr, sizeof( ptr ), &tv, DontExit ) ) return false; switch( type ) {