14 std::function<
void()> runEventLoop,
15 std::chrono::milliseconds
delta) {
26 [
this, runEventLoop]() ->
bool {
Simple class for background tasks that should be run periodically or once "after a while".
void scheduleEvery(Predicate p, std::chrono::milliseconds delta) EXCLUSIVE_LOCKS_REQUIRED(!newTaskMutex)
Repeat p until it return false.
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
std::atomic< bool > stopRequest
Start stop machinery.
std::condition_variable cond_running
bool stopEventLoop() EXCLUSIVE_LOCKS_REQUIRED(!cs_running)
bool startEventLoop(CScheduler &scheduler, std::function< void()> runEventLoop, std::chrono::milliseconds delta) EXCLUSIVE_LOCKS_REQUIRED(!cs_running)
#define WAIT_LOCK(cs, name)
#define EXCLUSIVE_LOCKS_REQUIRED(...)