Add Stoppable::alertable_sleep_for

This commit is contained in:
Vinnie Falco committed 2015-12-23 11:58:38 -05:00
1 parent 95dcdf7ddc
commit 3c6534dc91
2 files changed
+53 -7

No files matched your search

+8 -4
View File
@@ -183,12 +183,16 @@ void RootStoppable::stop (Journal j)
// Must have a prior call to start()
bassert (m_started);
if (m_calledStop.exchange (true) == true)
{
j.warning << "Stoppable::stop called again";
return;
std::lock_guard<std::mutex> lock(m_);
if (m_calledStop)
{
j.warning << "Stoppable::stop called again";
return;
}
m_calledStop = true;
c_.notify_all();
}
stopAsync (j);
stopRecursive (j);
}