C++ Actor Framework 1.0.0
|
A central place where workers return to after finishing a task. More...
#include <abstract_worker_hub.hpp>
Inherited by caf::detail::worker_hub< caf::io::basp::worker >, and caf::detail::worker_hub< Worker >.
Public Member Functions | |
void | await_workers () |
Waits until all workers are back at the hub. | |
Protected Member Functions | |
void | push_new (abstract_worker *ptr) |
Adds a new worker to the hub. | |
void | push_returning (abstract_worker *ptr) |
Returns a worker to the hub. | |
abstract_worker * | pop_impl () |
Tries to retrieve a worker from the hub. | |
abstract_worker * | peek_impl () |
Checks which worker would pop currently return. | |
Protected Attributes | |
std::atomic< abstract_worker * > | head_ |
std::atomic< size_t > | running_ |
std::mutex | mtx_ |
std::condition_variable | cv_ |
A central place where workers return to after finishing a task.
A hub supports any number of workers that call push
, but only a single master that calls pop
. The hub takes ownership of all workers. Workers register at the hub during construction and get destroyed when the hub gets destroyed.
|
protected |
Checks which worker would pop
currently return.
nullptr
if the hub is currently empty.
|
protected |
Tries to retrieve a worker from the hub.
nullptr
if the hub is currently empty.