parallel-cellular-automata
Framework for building parallel cellular automata.
Public Member Functions | List of all members
WorkStealingQueue< T > Class Template Reference

work-stealing queue. More...

#include <queues.hpp>

Public Member Functions

 WorkStealingQueue ()
 Construct a new WorkStealingQueue object.
 
 WorkStealingQueue (const WorkStealingQueue &other)=delete
 
void push (T data)
 Push data into the queue. More...
 
bool empty () const
 Check if the queue is empty. More...
 
bool try_pop (T &result)
 Try to pop an element from the front of the queue. More...
 
bool try_steal (T &result)
 Try to pop an element from the front of the queue. More...
 
size_t size () const
 returns the size of the queue. (The value may be outdated) More...
 

Detailed Description

template<typename T>
class WorkStealingQueue< T >

work-stealing queue.

This work-stealing queue is implemented as a simple wrapper around a deque.

To improve performance from a cache locality perspective the queue act as a LIFO for its own thread and as a FIFO for the stealing one.

Template Parameters
T

Member Function Documentation

◆ empty()

template<typename T >
bool WorkStealingQueue< T >::empty ( ) const
inline

Check if the queue is empty.

Returns
true if the queue is empty.
false if the queue is not empty.

◆ push()

template<typename T >
void WorkStealingQueue< T >::push ( data)
inline

Push data into the queue.

Parameters
datadata to push.

◆ size()

template<typename T >
size_t WorkStealingQueue< T >::size ( ) const
inline

returns the size of the queue. (The value may be outdated)

Returns
size_t

◆ try_pop()

template<typename T >
bool WorkStealingQueue< T >::try_pop ( T &  result)
inline

Try to pop an element from the front of the queue.

Parameters
resultreference where to insert the popped element.
Returns
true if the element has been popped.
false if the queue was empty.

◆ try_steal()

template<typename T >
bool WorkStealingQueue< T >::try_steal ( T &  result)
inline

Try to pop an element from the front of the queue.

Parameters
resultreference where to insert the popped element.
Returns
true if the element has been popped.
false if the queue was empty.

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