5 #ifndef FABCOIN_SCHEDULER_H 6 #define FABCOIN_SCHEDULER_H 13 #include <boost/chrono/chrono.hpp> 14 #include <boost/thread.hpp> 67 void stop(
bool drain=
false);
78 std::multimap<boost::chrono::system_clock::time_point, Function>
taskQueue;
84 bool shouldStop() {
return stopRequested || (stopWhenEmpty && taskQueue.empty()); }
99 bool m_are_callbacks_running =
false;
101 void MaybeScheduleProcessQueue();
Class used by CScheduler clients which may schedule multiple jobs which are required to be run serial...
#define function(a, b, c, d, k, s)
std::multimap< boost::chrono::system_clock::time_point, Function > taskQueue
void scheduleEvery(Function f, int64_t deltaMilliSeconds)
void scheduleFromNow(Function f, int64_t deltaMilliSeconds)
void schedule(Function f, boost::chrono::system_clock::time_point t=boost::chrono::system_clock::now())
CScheduler * m_pscheduler
void stop(bool drain=false)
std::function< void(void)> Function
SingleThreadedSchedulerClient(CScheduler *pschedulerIn)
boost::condition_variable newTaskScheduled
size_t getQueueInfo(boost::chrono::system_clock::time_point &first, boost::chrono::system_clock::time_point &last) const
bool AreThreadsServicingQueue() const
boost::mutex newTaskMutex
std::list< std::function< void(void)> > m_callbacks_pending
CCriticalSection m_cs_callbacks_pending
clock::time_point time_point
int nThreadsServicingQueue
Wrapped boost mutex: supports recursive locking, but no waiting TODO: We should move away from using ...