24 #ifndef DOBBYWORKQUEUE_H
25 #define DOBBYWORKQUEUE_H
33 #include "ConditionVariable.h"
43 bool runFor(
const std::chrono::milliseconds &msecs);
44 bool runUntil(
const std::chrono::steady_clock::time_point &deadline);
49 using WorkFunc = std::function<void()>;
51 bool doWork(WorkFunc &&work);
61 : tag(t), func(std::move(f))
65 uint64_t mWorkCounter;
68 std::atomic<std::thread::id> mRunningThreadId;
72 std::queue< WorkItem > mWorkQueue;
76 uint64_t mWorkCompleteCounter;
Definition: ConditionVariable.h:67
Definition: DobbyWorkQueue.h:37
void exit()
Unblocks the runXXX functions.
Definition: DobbyWorkQueue.cpp:52
bool runUntil(const std::chrono::steady_clock::time_point &deadline)
Runs the event loop until the deadline time passes.
Definition: DobbyWorkQueue.cpp:112
void run()
Runs the event loop.
Definition: DobbyWorkQueue.cpp:80
bool postWork(WorkFunc &&work)
Posts a work job onto the queue.
Definition: DobbyWorkQueue.cpp:246
bool doWork(WorkFunc &&work)
Posts a work job onto the queue and waits till it completes.
Definition: DobbyWorkQueue.cpp:196
bool runFor(const std::chrono::milliseconds &msecs)
Runs the event loop for msecs milliseconds.
Definition: DobbyWorkQueue.cpp:96
Definition: DobbyWorkQueue.h:56