iLab Neuromorphic Robotics Toolkit
0.1
|
#include <nrt/Core/Design/details/ThreadHelpers.H>
A light wrapper around std::deque used to allow different threads to "steal" work.
Based off of an implementation in C++ Concurrency in Action: Practical Multithreading by Anthony Williams
Definition at line 121 of file ThreadHelpers.H.
Public Member Functions | |
WorkStealingQueue () | |
Create an empty queue. | |
WorkStealingQueue (WorkStealingQueue const &other)=delete | |
WorkStealingQueue & | operator= (WorkStealingQueue const &other)=delete |
void | push (FunctionWrapper func) |
Push a function onto the queue. | |
bool | empty () const |
Is the queue empty? | |
bool | tryPop (FunctionWrapper &func) |
Try to pop a function from the beginning of the queue. | |
bool | trySteal (FunctionWrapper &func) |
Try to "steal" a function from the end of the queue. | |