Stops and waits for the worker thread to exit, flushing all pending lambdas
Request that the worker thread stop itself.
Blocking waits in the current thread for the worker thread to stop
std::future<bool> add(std::function<void()> f)¶
Adds a lambda to run on the worker thread; returns a future that can be used to block on its completion. Future status is
trueif the lambda was run in the worker thread;
falseif it was not run, because the worker thread is exiting or has exited.
Thread that all queued lambdas are run on.
Mutex for the queue and exit status.
Monitor for the exit status and the queue.
Whether or not we want the thread to exit.
std::deque<std::pair<std::function<void()>, std::promise<bool>>> queue_¶
Queue of pending lambdas to call.