add Timer::close()

An aid to orderly shutdown
This commit is contained in:
Michael Davidsaver
2018-04-02 12:25:46 -07:00
parent 87ade13234
commit 7b8ef390ce
2 changed files with 8 additions and 0 deletions

View File

@@ -160,8 +160,14 @@ void Timer::run()
}
Timer::~Timer() {
close();
}
void Timer::close() {
{
Lock xx(mutex);
if(!alive)
return; // already closed
alive = false;
}
waitForWork.signal();