Bitcoin Core  0.19.99
P2P Digital Currency
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
CScheduler Class Reference

#include <scheduler.h>

Public Types

typedef std::function< void()> Function
 

Public Member Functions

 CScheduler ()
 
 ~CScheduler ()
 
void schedule (Function f, boost::chrono::system_clock::time_point t=boost::chrono::system_clock::now())
 
void scheduleFromNow (Function f, int64_t deltaMilliSeconds)
 
void scheduleEvery (Function f, int64_t deltaMilliSeconds)
 
void MockForward (boost::chrono::seconds delta_seconds)
 Mock the scheduler to fast forward in time. More...
 
void serviceQueue ()
 
void stop (bool drain=false)
 
size_t getQueueInfo (boost::chrono::system_clock::time_point &first, boost::chrono::system_clock::time_point &last) const
 
bool AreThreadsServicingQueue () const
 

Private Member Functions

bool shouldStop () const
 

Private Attributes

std::multimap< boost::chrono::system_clock::time_point, FunctiontaskQueue
 
boost::condition_variable newTaskScheduled
 
boost::mutex newTaskMutex
 
int nThreadsServicingQueue
 
bool stopRequested
 
bool stopWhenEmpty
 

Detailed Description

Definition at line 37 of file scheduler.h.

Member Typedef Documentation

◆ Function

typedef std::function<void()> CScheduler::Function

Definition at line 43 of file scheduler.h.

Constructor & Destructor Documentation

◆ CScheduler()

CScheduler::CScheduler ( )

Definition at line 13 of file scheduler.cpp.

◆ ~CScheduler()

CScheduler::~CScheduler ( )

Definition at line 17 of file scheduler.cpp.

Member Function Documentation

◆ AreThreadsServicingQueue()

bool CScheduler::AreThreadsServicingQueue ( ) const

Definition at line 162 of file scheduler.cpp.

◆ getQueueInfo()

size_t CScheduler::getQueueInfo ( boost::chrono::system_clock::time_point &  first,
boost::chrono::system_clock::time_point &  last 
) const

Definition at line 150 of file scheduler.cpp.

◆ MockForward()

void CScheduler::MockForward ( boost::chrono::seconds  delta_seconds)

Mock the scheduler to fast forward in time.

Iterates through items on taskQueue and reschedules them to be delta_seconds sooner.

Definition at line 117 of file scheduler.cpp.

◆ schedule()

void CScheduler::schedule ( CScheduler::Function  f,
boost::chrono::system_clock::time_point  t = boost::chrono::system_clock::now() 
)

Definition at line 103 of file scheduler.cpp.

Here is the caller graph for this function:

◆ scheduleEvery()

void CScheduler::scheduleEvery ( CScheduler::Function  f,
int64_t  deltaMilliSeconds 
)

Definition at line 145 of file scheduler.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scheduleFromNow()

void CScheduler::scheduleFromNow ( CScheduler::Function  f,
int64_t  deltaMilliSeconds 
)

Definition at line 112 of file scheduler.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ serviceQueue()

void CScheduler::serviceQueue ( )

Definition at line 32 of file scheduler.cpp.

Here is the call graph for this function:

◆ shouldStop()

bool CScheduler::shouldStop ( ) const
inlineprivate

Definition at line 91 of file scheduler.h.

Here is the caller graph for this function:

◆ stop()

void CScheduler::stop ( bool  drain = false)

Definition at line 91 of file scheduler.cpp.

Member Data Documentation

◆ newTaskMutex

boost::mutex CScheduler::newTaskMutex
mutableprivate

Definition at line 87 of file scheduler.h.

◆ newTaskScheduled

boost::condition_variable CScheduler::newTaskScheduled
private

Definition at line 86 of file scheduler.h.

◆ nThreadsServicingQueue

int CScheduler::nThreadsServicingQueue
private

Definition at line 88 of file scheduler.h.

◆ stopRequested

bool CScheduler::stopRequested
private

Definition at line 89 of file scheduler.h.

◆ stopWhenEmpty

bool CScheduler::stopWhenEmpty
private

Definition at line 90 of file scheduler.h.

◆ taskQueue

std::multimap<boost::chrono::system_clock::time_point, Function> CScheduler::taskQueue
private

Definition at line 85 of file scheduler.h.


The documentation for this class was generated from the following files: