SOFA API  6a688117
Open source framework for multi-physics simuation
sofa::helper::system::thread::ManyThreadsPerEnd Class Reference

#include <CircularQueue.h>

Inheritance diagram for sofa::helper::system::thread::ManyThreadsPerEnd:

Detailed Description

This is a lock-free (but not wait-free) multi-producer multi-consumer implementation of a circular queue matching the ThreadAccessPolicy of CircularQueue.

Note
maxCapacity parameters MUST always be a power of 2.

Protected Attributes

AtomicInt head
 
AtomicInt tail
 

Protected Member Functions

 ManyThreadsPerEnd ()
 
bool isEmpty (unsigned maxSize) const
 
bool isFull (unsigned maxSize) const
 
unsigned size (unsigned maxSize) const
 
void init (AtomicInt array[], int maxCapacity)
 
bool push (AtomicInt array[], int maxSize, int maxCapacity, const AtomicInt &item)
 
bool pop (AtomicInt array[], int maxSize, int maxCapacity, AtomicInt &item, bool clear=true)
 
unsigned skip (AtomicInt array[], int maxSize, int maxCapacity, unsigned outmaxsize, bool clear=true)
 
template<class OutputIterator >
unsigned pop (AtomicInt array[], int maxSize, int maxCapacity, OutputIterator out, unsigned outmaxsize, bool clear=true)
 

Attribute details

AtomicInt sofa::helper::system::thread::ManyThreadsPerEnd::head
protected
AtomicInt sofa::helper::system::thread::ManyThreadsPerEnd::tail
protected

Constructor details

SOFA_HELPER_API sofa::helper::system::thread::ManyThreadsPerEnd::ManyThreadsPerEnd ( )
inlineprotected

Function details

SOFA_HELPER_API void sofa::helper::system::thread::ManyThreadsPerEnd::init ( AtomicInt  array[],
int  maxCapacity 
)
inlineprotected
SOFA_HELPER_API bool sofa::helper::system::thread::ManyThreadsPerEnd::isEmpty ( unsigned  maxSize) const
inlineprotected
SOFA_HELPER_API bool sofa::helper::system::thread::ManyThreadsPerEnd::isFull ( unsigned  maxSize) const
inlineprotected
SOFA_HELPER_API bool sofa::helper::system::thread::ManyThreadsPerEnd::pop ( AtomicInt  array[],
int  maxSize,
int  maxCapacity,
AtomicInt item,
bool  clear = true 
)
inlineprotected
template<class OutputIterator >
unsigned sofa::helper::system::thread::ManyThreadsPerEnd::pop ( AtomicInt  array[],
int  maxSize,
int  maxCapacity,
OutputIterator  out,
unsigned  outmaxsize,
bool  clear = true 
)
protected
SOFA_HELPER_API bool sofa::helper::system::thread::ManyThreadsPerEnd::push ( AtomicInt  array[],
int  maxSize,
int  maxCapacity,
const AtomicInt item 
)
inlineprotected
SOFA_HELPER_API unsigned sofa::helper::system::thread::ManyThreadsPerEnd::size ( unsigned  maxSize) const
inlineprotected
SOFA_HELPER_API unsigned sofa::helper::system::thread::ManyThreadsPerEnd::skip ( AtomicInt  array[],
int  maxSize,
int  maxCapacity,
unsigned  outmaxsize,
bool  clear = true 
)
inlineprotected