Spreads task execution across a pool of re-usable threads. Uses a lock-free work-stealing queue to ensure workers are never idle.
More...
#include <Pool.h>
|
| struct | Task |
| | All tasks must inherit from this class. std::function is not used here to avoid the operator() virtual call. More...
|
| |
|
| | Pool (szt workerCount, szt workerTaskMax) |
| |
| | ~Pool () |
| |
| template<class Task > |
| void | enqueue (Task &&task) |
| | Schedule a task for execution. More...
|
| |
| | SharedObj (Alloc &&a=Alloc()) debug_if( |
| | Construct with allocator that is called to deallocate this shared object when all references have been released. More...
|
| |
|
| static Task * | current () |
| | Get the current task object of the calling thread. Must be called from inside a task, returns null otherwise. More...
|
| |
|
| void | finalize () |
| | Destroys object. Called when strong reference count reaches 0. May be overridden to prevent destruction. More...
|
| |
Spreads task execution across a pool of re-usable threads. Uses a lock-free work-stealing queue to ensure workers are never idle.
| honey::thread::Pool::Pool |
( |
szt |
workerCount, |
|
|
szt |
workerTaskMax |
|
) |
| |
- Parameters
-
| workerCount | Number of workers |
| workerTaskMax | Max size of per-worker task queue, overflow will be pushed onto pool queue |
| honey::thread::Pool::~Pool |
( |
| ) |
|
| static Task* honey::thread::Pool::current |
( |
| ) |
|
|
inlinestatic |
Get the current task object of the calling thread. Must be called from inside a task, returns null otherwise.
template<class Task >
| void honey::thread::Pool::enqueue |
( |
Task && |
task | ) |
|
|
inline |
Schedule a task for execution.
The documentation for this class was generated from the following files: