#include <toast/async/worker_pool.hpp>
requests that don't share data or that have synchronized their shared data properly may run on any worker. The worker_pool makes it easy to distribute those kind of requests over many workers. Those that share data but are not synchronized must be run on a single thread. If it doesn't matter which single thread, then one can be retrieved through some_worker().
Public Member Functions | |
worker_pool (int number_of_workers, bool complete=false) | |
create some number of workers within the worker_pool. | |
void | push (request const &) |
request some work to be done by some worker in the pool. | |
void | push (std::list< request > &) |
request some work to be done by some worker in the pool. | |
Classes | |
struct | impl |
void toast::async::worker_pool::push | ( | request const & | r | ) |
request some work to be done by some worker in the pool.
If you need to push many requests call the other push.
void toast::async::worker_pool::push | ( | std::list< request > & | l | ) |
request some work to be done by some worker in the pool.
The list will be empty after the call.