20 #ifndef RIPPLE_CORE_STOPPABLE_H_INCLUDED
21 #define RIPPLE_CORE_STOPPABLE_H_INCLUDED
23 #include <ripple/beast/core/LockFreeStack.h>
24 #include <ripple/beast/utility/Journal.h>
25 #include <ripple/core/ClosureCounter.h>
26 #include <ripple/core/Job.h>
429 std::chrono::system_clock::time_point
const& t)
virtual ~Stoppable()
Destroy the Stoppable.
Child(Stoppable *stoppable_)
std::atomic< bool > m_stopped
void stopped()
Called by derived classes to indicate that the stoppable has stopped.
virtual void onStop()
Override called when the stop notification is issued.
std::atomic< bool > startEntered_
bool alertable_sleep_until(std::chrono::system_clock::time_point const &t)
Sleep or wake up on stop.
std::atomic< bool > stopEntered_
Stoppable(std::string name, RootStoppable &root)
virtual void onStart()
Override called during start.
void setParent(Stoppable &parent)
Set the parent of this Stoppable.
void stopAsyncRecursive(beast::Journal j)
void stop(beast::Journal j)
Notify a root stoppable and children to stop, and block until stopped.
bool isStopped() const
Returns true if the requested stop has completed.
Provides an interface for starting and stopping.
std::atomic< bool > startExited_
virtual void onPrepare()
Override called during preparation.
bool areChildrenStopped() const
Returns true if all children have stopped.
std::condition_variable m_cv
JobCounter & jobCounter()
JobCounter & jobCounter()
A generic endpoint for log messages.
bool alertable_sleep_until(std::chrono::system_clock::time_point const &t)
Sleep or wake up on stop.
void stopRecursive(beast::Journal j)
friend class RootStoppable
void start()
Prepare and start all contained Stoppable objects.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
std::atomic< bool > m_childrenStopped
virtual void onChildrenStopped()
Override called when all children have stopped.
bool started() const
Return true if start() was ever called.
RootStoppable & getRoot()
std::condition_variable c_
bool isStopping() const
Returns true if the stoppable should stop.