SOFA API  b3f2f2a4
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

◆ head

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

◆ tail

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

Constructor details

◆ ManyThreadsPerEnd()

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

Function details

◆ init()

SOFA_HELPER_API void sofa::helper::system::thread::ManyThreadsPerEnd::init ( AtomicInt  array[],
int  maxCapacity 
)
inlineprotected

◆ isEmpty()

SOFA_HELPER_API bool sofa::helper::system::thread::ManyThreadsPerEnd::isEmpty ( unsigned  maxSize) const
inlineprotected

◆ isFull()

SOFA_HELPER_API bool sofa::helper::system::thread::ManyThreadsPerEnd::isFull ( unsigned  maxSize) const
inlineprotected

◆ pop() [1/2]

SOFA_HELPER_API bool sofa::helper::system::thread::ManyThreadsPerEnd::pop ( AtomicInt  array[],
int  maxSize,
int  maxCapacity,
AtomicInt item,
bool  clear = true 
)
inlineprotected

◆ pop() [2/2]

template<class OutputIterator >
unsigned sofa::helper::system::thread::ManyThreadsPerEnd::pop ( AtomicInt  array[],
int  maxSize,
int  maxCapacity,
OutputIterator  out,
unsigned  outmaxsize,
bool  clear = true 
)
protected

◆ push()

SOFA_HELPER_API bool sofa::helper::system::thread::ManyThreadsPerEnd::push ( AtomicInt  array[],
int  maxSize,
int  maxCapacity,
const AtomicInt item 
)
inlineprotected

◆ size()

SOFA_HELPER_API unsigned sofa::helper::system::thread::ManyThreadsPerEnd::size ( unsigned  maxSize) const
inlineprotected

◆ skip()

SOFA_HELPER_API unsigned sofa::helper::system::thread::ManyThreadsPerEnd::skip ( AtomicInt  array[],
int  maxSize,
int  maxCapacity,
unsigned  outmaxsize,
bool  clear = true 
)
inlineprotected