Changeset View
Changeset View
Standalone View
Standalone View
src/scheduler.h
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | |||||
private: | private: | ||||
std::multimap<boost::chrono::system_clock::time_point, Function> taskQueue; | std::multimap<boost::chrono::system_clock::time_point, Function> taskQueue; | ||||
boost::condition_variable newTaskScheduled; | boost::condition_variable newTaskScheduled; | ||||
mutable boost::mutex newTaskMutex; | mutable boost::mutex newTaskMutex; | ||||
int nThreadsServicingQueue; | int nThreadsServicingQueue; | ||||
bool stopRequested; | bool stopRequested; | ||||
bool stopWhenEmpty; | bool stopWhenEmpty; | ||||
bool shouldStop() { | bool shouldStop() const { | ||||
return stopRequested || (stopWhenEmpty && taskQueue.empty()); | return stopRequested || (stopWhenEmpty && taskQueue.empty()); | ||||
} | } | ||||
}; | }; | ||||
/** | /** | ||||
* Class used by CScheduler clients which may schedule multiple jobs | * Class used by CScheduler clients which may schedule multiple jobs | ||||
* which are required to be run serially. Does not require such jobs | * which are required to be run serially. Does not require such jobs | ||||
* to be executed on the same thread, but no two jobs will be executed | * to be executed on the same thread, but no two jobs will be executed | ||||
Show All 25 Lines |