Cpp-Taskflow
2.1.0
|
Executor that implements an efficient work stealing algorithm. More...
#include <workstealing_threadpool.hpp>
Public Member Functions | |
WorkStealingThreadpool (unsigned N) | |
constructs the executor with a given number of worker threads More... | |
~WorkStealingThreadpool () | |
destructs the executor More... | |
size_t | num_workers () const |
queries the number of worker threads | |
bool | is_owner () const |
queries if the caller is the owner of the executor | |
template<typename... ArgsT> | |
void | emplace (ArgsT &&... args) |
constructs the closure in place in the executor More... | |
void | batch (std::vector< Closure > &&closures) |
moves a batch of closures to the executor More... | |
Executor that implements an efficient work stealing algorithm.
Closure | closure type |
|
explicit |
constructs the executor with a given number of worker threads
N | the number of worker threads |
tf::WorkStealingThreadpool< Closure >::~WorkStealingThreadpool | ( | ) |
destructs the executor
Destructing the executor will immediately force all worker threads to stop. The executor does not guarantee all tasks to finish upon destruction.
void tf::WorkStealingThreadpool< Closure >::batch | ( | std::vector< Closure > && | closures | ) |
moves a batch of closures to the executor
closures | a vector of closures to move |
void tf::WorkStealingThreadpool< Closure >::emplace | ( | ArgsT &&... | args | ) |
constructs the closure in place in the executor
ArgsT... | argument parameter pack |
args... | arguments to forward to the constructor of the closure |