Mercury Currency Engine
|
#include <threadpool.hpp>
Public Member Functions | |
virtual | ~threadpool () |
halt(), join() and delete all workers | |
size_t | size () const |
return the count of worker threads | |
scheduler & | worker (size_t idx) const |
access the scheduler for a worker at a given index | |
scheduler & | worker () |
return the least busy worker scheduler at time of call | |
std::vector< std::shared_ptr< scheduler > > | workers () |
operator std::shared_ptr< threadpool > () | |
return a copy of this threadpool's shared pointer by conversion | |
Public Member Functions inherited from mce::lifecycle | |
lifecycle (implementation *self) | |
lifecycle (implementation *self, implementation *root) | |
state | get_state () |
return the state of the lifecycle | |
bool | suspend () |
temporarily suspend operations More... | |
void | resume () |
resume any current or future call to run() after an suspend() | |
void | halt () |
halt and join lifecycle execution More... | |
Static Public Member Functions | |
static std::shared_ptr< threadpool > | make (size_t worker_count=0) |
construct an allocated threadpool with a count of worker threads | |
Protected Member Functions | |
lifecycle::state | get_state_impl () |
bool | suspend_impl () |
void | resume_impl () |
void | halt_impl () |
Additional Inherited Members | |
Public Types inherited from mce::lifecycle | |
enum | state { ready , running , suspended , halted } |
an enumeration which represents the lifecycle object's current state More... | |
Threadpool objects launch, maintain, and shutdown worker threads running schedulers
|
inline |
This operation is more expensive than calling worker(). It should be unnecessary in most cases to call this method, but it is provided in case some sort of high level scheduler management is desired by the user and access to all of std::vector
's utility functionality would be beneficial.