6 #ifndef PIVX_SCHEDULER_H
7 #define PIVX_SCHEDULER_H
14 #include <condition_variable>
69 void stop(
bool drain=
false);
bool stopWhenEmpty GUARDED_BY(newTaskMutex)
bool stopRequested GUARDED_BY(newTaskMutex)
void stop(bool drain=false)
void schedule(Function f, std::chrono::system_clock::time_point t)
std::multimap< std::chrono::system_clock::time_point, Function > taskQueue GUARDED_BY(newTaskMutex)
std::function< void(void)> Function
int nThreadsServicingQueue GUARDED_BY(newTaskMutex)
void scheduleFromNow(Function f, int64_t deltaMilliSeconds)
size_t getQueueInfo(std::chrono::system_clock::time_point &first, std::chrono::system_clock::time_point &last) const
void scheduleEvery(Function f, int64_t deltaMilliSeconds)
bool shouldStop() const EXCLUSIVE_LOCKS_REQUIRED(newTaskMutex)
bool AreThreadsServicingQueue() const
std::condition_variable newTaskScheduled
Class used by CScheduler clients which may schedule multiple jobs which are required to be run serial...
void MaybeScheduleProcessQueue()
size_t CallbacksPending()
RecursiveMutex m_cs_callbacks_pending
CScheduler * m_pscheduler
std::list< std::function< void(void)> > m_callbacks_pending
SingleThreadedSchedulerClient(CScheduler *pschedulerIn)
bool m_are_callbacks_running
void AddToProcessQueue(std::function< void(void)> func)
Add a callback to be executed.
clock::time_point time_point
#define EXCLUSIVE_LOCKS_REQUIRED(...)