toast::async::worker Class Reference
[toast asynchronous library]

#include <toast/async/worker.hpp>

List of all members.


Detailed Description

represents a thread and provides a way of passing it requests.

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

Constructor & Destructor Documentation

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.


Member Function Documentation

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  ) 

request some work to be done specifically by this worker.

All requests in the list will be pushed to the worker. The list will be empty after the call.


The documentation for this class was generated from the following files:

SourceForge.net Logo