mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Clean-up the Stoppable architecture
This commit is contained in:
committed by
Edward Hennis
parent
1fd1c34112
commit
78245a072c
@@ -150,7 +150,7 @@ SHAMapStoreImp::SHAMapStoreImp(
|
||||
Stoppable& parent,
|
||||
NodeStore::Scheduler& scheduler,
|
||||
beast::Journal journal)
|
||||
: SHAMapStore(parent)
|
||||
: Stoppable("SHAMapStore", parent)
|
||||
, app_(app)
|
||||
, scheduler_(scheduler)
|
||||
, journal_(journal)
|
||||
@@ -731,6 +731,7 @@ SHAMapStoreImp::health()
|
||||
void
|
||||
SHAMapStoreImp::onStop()
|
||||
{
|
||||
// This is really a check for `if (thread_)`.
|
||||
if (deleteInterval_)
|
||||
{
|
||||
{
|
||||
@@ -738,26 +739,12 @@ SHAMapStoreImp::onStop()
|
||||
stop_ = true;
|
||||
}
|
||||
cond_.notify_one();
|
||||
// stopped() will be called by the thread_ running run(),
|
||||
// when it reaches the check for stop_.
|
||||
}
|
||||
else
|
||||
{
|
||||
stopped();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SHAMapStoreImp::onChildrenStopped()
|
||||
{
|
||||
if (deleteInterval_)
|
||||
{
|
||||
{
|
||||
std::lock_guard lock(mutex_);
|
||||
stop_ = true;
|
||||
}
|
||||
cond_.notify_one();
|
||||
}
|
||||
else
|
||||
{
|
||||
// There is no thread running run(), so we must call stopped().
|
||||
stopped();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user