5#ifndef BITCOIN_EVENTLOOP_H
6#define BITCOIN_EVENTLOOP_H
13#include <condition_variable>
24 std::function<
void()> runEventLoop,
25 std::chrono::milliseconds
delta)
Simple class for background tasks that should be run periodically or once "after a while".
Implement std::hash so RCUPtr can be used as a key for maps or sets.
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.
bool running GUARDED_BY(cs_running)
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 EXCLUSIVE_LOCKS_REQUIRED(...)