iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::WorkStealingQueue Class Reference

#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
 
WorkStealingQueueoperator= (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.
 

The documentation for this class was generated from the following file: