hopefully finally fix last interesting race-condition

This commit is contained in:
Bernhard Amann 2013-05-15 15:36:34 -07:00
parent 808639fc5f
commit 37566e73d8

View file

@ -196,7 +196,7 @@ void MsgThread::OnWaitForStop()
uint64_t last_size = 0; uint64_t last_size = 0;
uint64_t cur_size = 0; uint64_t cur_size = 0;
while ( ! (main_finished || Killed() ) ) while ( ! main_finished )
{ {
// Terminate if we get another kill signal. // Terminate if we get another kill signal.
if ( signal_val == SIGTERM || signal_val == SIGINT ) if ( signal_val == SIGTERM || signal_val == SIGINT )
@ -221,8 +221,10 @@ void MsgThread::OnWaitForStop()
signal_val = 0; signal_val = 0;
} }
queue_in.WakeUp(); if ( !Killed() )
while ( HasOut() && !Killed() ) queue_in.WakeUp();
while ( HasOut() )
{ {
Message* msg = RetrieveOut(); Message* msg = RetrieveOut();
assert ( msg ); assert ( msg );