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>
446 std::chrono::system_clock::time_point
const& t)
virtual ~Stoppable()
Destroy the Stoppable.
Child(Stoppable *stoppable_)
bool stopAsync(beast::Journal j)
std::atomic< bool > m_prepared
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.
bool alertable_sleep_until(std::chrono::system_clock::time_point const &t)
Sleep or wake up on stop.
Stoppable(std::string name, RootStoppable &root)
virtual void onStart()
Override called during start.
void setParent(Stoppable &parent)
Set the parent of this Stoppable.
void prepare()
Prepare all contained Stoppable objects.
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.
virtual void onPrepare()
Override called during preparation.
bool areChildrenStopped() const
Returns true if all children have stopped.
std::condition_variable m_cv
JobCounter & jobCounter()
std::atomic< bool > m_calledStop
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)
std::atomic< bool > m_started
friend class RootStoppable
void start()
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.