diff --git a/src/threading/BasicThread.cc b/src/threading/BasicThread.cc index 09b6e95d7a..7f5dbfc56b 100644 --- a/src/threading/BasicThread.cc +++ b/src/threading/BasicThread.cc @@ -135,10 +135,7 @@ void BasicThread::WaitForStop() if ( ! started ) return; - if ( terminating ) - return; - - DBG_LOG(DBG_THREADING, "Waiting for thread %s to terminate ...", name); + DBG_LOG(DBG_THREADING, "Waiting for thread %s to terminate and process last queue items...", name); OnWaitForStop(); diff --git a/src/threading/MsgThread.cc b/src/threading/MsgThread.cc index 1e52d61427..553641c282 100644 --- a/src/threading/MsgThread.cc +++ b/src/threading/MsgThread.cc @@ -234,7 +234,8 @@ void MsgThread::OnWaitForStop() delete msg; } - usleep(1000); + if ( !Killed() ) + usleep(1000); } signal_val = old_signal_val;