mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add Stoppable::alertable_sleep_for
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user