#include <toast/async/worker.hpp>
Public Member Functions | |
worker (bool complete=false) | |
spawn a thread and begin processing requests | |
void | complete () |
tell the worker to complete all its requests before it exits. | |
~worker () | |
throws away any pending requests and joins the thread. | |
void | push (request const &) |
request some work to be done specifically by this worker. | |
void | push (std::list< request > &) |
request some work to be done specifically by this worker. | |
Classes | |
struct | impl |
toast::async::worker::worker | ( | bool | complete = false |
) |
spawn a thread and begin processing requests
Requests accepted specifically by this worker take priority, but when none exist requests dispatched via dispatcher::dispatch will be processed.
A complete argument of true tells the worker that it must finish all of its requests before exiting. An argument of false (the default) tells it to abandon any pending requests at exit.
void toast::async::worker::push | ( | request const & | r | ) |
request some work to be done specifically by this worker.
If you don't need the work done by a specific worker send it to a worker_pool instead. If you need to push many requests call the other push.
void toast::async::worker::push | ( | std::list< request > & | l | ) |