bool

Configures a data structure as fixed-sized.

The internal nodes are stored inside an array and they are addressed by array indexing. This limits the possible size of the queue to the number of elements that can be addressed by the index type (usually 2**16-2), but on platforms that lack double-width compare-and-exchange instructions, this is the best way to achieve lock-freedom. This implies that a data structure is bounded.

size_t

Sets the capacity of a data structure at compile-time.

This implies that a data structure is bounded and fixed-sized.

Defines the allocator type of a data structure.

...

The queue class provides a multi-writer/multi-reader queue, pushing and popping is lock-free, construction/destruction has to be synchronized. It uses a freelist for memory management, freed nodes are pushed to the freelist and not returned to the OS before the queue is destroyed.

Policies:

- `boost::lockfree::fixed_sized`, defaults to `boost::lockfree::fixed_sized<false>` Can be used to completely disable dynamic memory allocations during push in order to ensure lockfree behavior. If the data structure is configured as fixed-sized, the internal nodes are stored inside an array and they are addressed by array indexing. This limits the possible size of the queue to the number of elements that can be addressed by the index type (usually 2**16-2), but on platforms that lack double-width compare-and-exchange instructions, this is the best way to achieve lock-freedom.

- `boost::lockfree::capacity`, optional If this template argument is passed to the options, the size of the queue is set at compile-time. It this option implies `fixed_sized<true>`

- `boost::lockfree::allocator`, defaults to ``boost::lockfree::allocator`<std::allocator<void>>` Specifies the allocator that is used for the internal freelist

Requirements:

- T must have a copy constructor

- T must have a trivial assignment operator

- T must have a trivial destructor

void
Construct queue.
typename node_allocator::template rebind< U >::other const &
allocator const &
size_type
Construct queue, allocate n nodes for the freelist.
size_type
typename node_allocator::template rebind< U >::other const &
T
implementation_defined::allocator
implementation_defined::size_type
bool `void`

It only checks, if the queue head and tail nodes and the freelist can be modified in a lock-free manner. On most platforms, the whole implementation is lock-free, if this is true. Using c++0x-style atomics, there is no possibility to provide a completely accurate implementation, because one would need to test every internal node, which is impossible if further nodes will be allocated from the operating system.

true, if implementation is lock-free.

void `size_type`

Allocate n nodes for freelist

thread-safe, may block if memory allocator blocks

void `size_type`

Allocate n nodes for freelist

not thread-safe, may block if memory allocator blocks

bool `void`

Check if the queue is empty

The result is only accurate, if no other thread modifies the queue. Therefore it is rarely practical to use this value in program logic.

true, if the queue is empty, false otherwise

bool `T const &`

Pushes object t to the queue.

Thread-safe. If internal memory pool is exhausted and the memory pool is not fixed-sized, a new node will be allocated from the OS. This may not be lock-free.

object will be pushed to the queue, if internal node can be allocated

true, if the push operation is successful.

bool `T const &`

Pushes object t to the queue.

Thread-safe and non-blocking. If internal memory pool is exhausted, operation will fail

object will be pushed to the queue, if internal node can be allocated

true, if the push operation is successful.

`if` memory allocator throws

bool `T const &`

Pushes object t to the queue.

Not Thread-safe. If internal memory pool is exhausted and the memory pool is not fixed-sized, a new node will be allocated from the OS. This may not be lock-free.

object will be pushed to the queue, if internal node can be allocated

true, if the push operation is successful.

`if` memory allocator throws

bool `T &`

Pops object from queue.

Thread-safe and non-blocking

if pop operation is successful, object will be copied to ret.

true, if the pop operation is successful, false if queue was empty.

bool `U &`

Pops object from queue.

Thread-safe and non-blocking

type U must be constructible by T and copyable, or T must be convertible to U

if pop operation is successful, object will be copied to ret.

true, if the pop operation is successful, false if queue was empty.

bool `T &`

Pops object from queue.

Not thread-safe, but non-blocking

if pop operation is successful, object will be copied to ret.

true, if the pop operation is successful, false if queue was empty.

bool `U &`

Pops object from queue.

Not thread-safe, but non-blocking

type U must be constructible by T and copyable, or T must be convertible to U

if pop operation is successful, object will be copied to ret.

true, if the pop operation is successful, false if queue was empty.

bool `Functor &`

consumes one element via a functor

pops one element from the queue and applies the functor on this object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

true, if one element was consumed

bool `Functor const &`

consumes one element via a functor

pops one element from the queue and applies the functor on this object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

size_t `Functor &`

consumes all elements via a functor

sequentially pops all elements from the queue and applies the functor on each object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

number of elements that are consumed

size_t `Functor const &`

consumes all elements via a functor

sequentially pops all elements from the queue and applies the functor on each object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

void

Destroys queue, free all nodes from freelist.

...

The `spsc_queue` class provides a single-writer/single-reader fifo queue, pushing and popping is wait-free.

Policies:

- `boost::lockfree::capacity<>`, optional If this template argument is passed to the options, the size of the ringbuffer is set at compile-time.

- `boost::lockfree::allocator<>`, defaults to ``boost::lockfree::allocator`<std::allocator<T>>` Specifies the allocator that is used to allocate the ringbuffer. This option is only valid, if the ringbuffer is configured to be sized at run-time

Requirements:

- T must have a default constructor

- T must be copyable

void

Constructs a `spsc_queue`

`spsc_queue` must be configured to be sized at compile-time

typename allocator::template rebind< U >::other const &
allocator const &
size_type

Constructs a `spsc_queue` for element_count elements

`spsc_queue` must be configured to be sized at run-time

size_type
typename allocator::template rebind< U >::other const &
size_type
allocator_arg const &
T
implementation_defined::allocator
implementation_defined::size_type
bool `T const &`

Pushes object t to the ringbuffer.

Thread-safe and wait-free

only one thread is allowed to push data to the `spsc_queue`

object will be pushed to the `spsc_queue`, unless it is full.

true, if the push operation is successful.

bool

Pops one object from ringbuffer.

Thread-safe and wait-free

only one thread is allowed to pop data to the `spsc_queue`

if ringbuffer is not empty, object will be discarded.

true, if the pop operation is successful, false if ringbuffer was empty.

boost::enable_if< typename is_convertible< T, U >::type, bool >::type `U &`

Pops one object from ringbuffer.

Thread-safe and wait-free

only one thread is allowed to pop data to the `spsc_queue`

if ringbuffer is not empty, object will be copied to ret.

true, if the pop operation is successful, false if ringbuffer was empty.

size_type `T const *` `size_type`

Pushes as many objects from the array t as there is space.

Thread-safe and wait-free

only one thread is allowed to push data to the `spsc_queue`

number of pushed items

size_type size_type `T const (&)`

Pushes as many objects from the array t as there is space available.

Thread-safe and wait-free

only one thread is allowed to push data to the `spsc_queue`

number of pushed items

ConstIterator `ConstIterator` `ConstIterator`

Pushes as many objects from the range [begin, end) as there is space .

Thread-safe and wait-free

only one thread is allowed to push data to the `spsc_queue`

iterator to the first element, which has not been pushed

size_type `T *` `size_type`

Pops a maximum of size objects from ringbuffer.

Thread-safe and wait-free

only one thread is allowed to pop data to the `spsc_queue`

number of popped items

size_type size_type `T(&)`

Pops a maximum of size objects from `spsc_queue`.

Thread-safe and wait-free

only one thread is allowed to pop data to the `spsc_queue`

number of popped items

boost::disable_if< typename is_convertible< T, OutputIterator >::type, size_type >::type `OutputIterator`

Pops objects to the output iterator it

Thread-safe and wait-free

only one thread is allowed to pop data to the `spsc_queue`

number of popped items

bool `Functor &`

consumes one element via a functor

pops one element from the queue and applies the functor on this object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

true, if one element was consumed

bool `Functor const &`

consumes one element via a functor

pops one element from the queue and applies the functor on this object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

size_type `Functor &`

consumes all elements via a functor

sequentially pops all elements from the queue and applies the functor on each object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

number of elements that are consumed

size_type `Functor const &`

consumes all elements via a functor

sequentially pops all elements from the queue and applies the functor on each object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

size_type

get number of elements that are available for read

Thread-safe and wait-free, should only be called from the consumer thread

number of available elements that can be popped from the `spsc_queue`

size_type

get write space to write elements

Thread-safe and wait-free, should only be called from the producer thread

number of elements that can be pushed to the `spsc_queue`

const T &

get reference to element in the front of the queue

Availability of front element can be checked using read_available().

Thread-safe and wait-free

only a consuming thread is allowed to check front element

read_available() > 0. If ringbuffer is empty, it's undefined behaviour to invoke this method.

reference to the first element in the queue

T &

get reference to element in the front of the queue

Availability of front element can be checked using read_available().

Thread-safe and wait-free

void `void`

reset the ringbuffer

Not thread-safe

...

The stack class provides a multi-writer/multi-reader stack, pushing and popping is lock-free, construction/destruction has to be synchronized. It uses a freelist for memory management, freed nodes are pushed to the freelist and not returned to the OS before the stack is destroyed.

Policies:

- `boost::lockfree::fixed_sized<>`, defaults to `boost::lockfree::fixed_sized<false>` Can be used to completely disable dynamic memory allocations during push in order to ensure lockfree behavior. If the data structure is configured as fixed-sized, the internal nodes are stored inside an array and they are addressed by array indexing. This limits the possible size of the stack to the number of elements that can be addressed by the index type (usually 2**16-2), but on platforms that lack double-width compare-and-exchange instructions, this is the best way to achieve lock-freedom.

- `boost::lockfree::capacity<>`, optional If this template argument is passed to the options, the size of the stack is set at compile-time. It this option implies `fixed_sized<true>`

- `boost::lockfree::allocator<>`, defaults to ``boost::lockfree::allocator`<std::allocator<void>>` Specifies the allocator that is used for the internal freelist

Requirements:

- T must have a copy constructor

void
Construct stack.
typename node_allocator::template rebind< U >::other const &
allocator const &
size_type
Construct stack, allocate n nodes for the freelist.
size_type
typename node_allocator::template rebind< U >::other const &
T
implementation_defined::allocator
implementation_defined::size_type
bool `void`

It only checks, if the top stack node and the freelist can be modified in a lock-free manner. On most platforms, the whole implementation is lock-free, if this is true. Using c++0x-style atomics, there is no possibility to provide a completely accurate implementation, because one would need to test every internal node, which is impossible if further nodes will be allocated from the operating system.

true, if implementation is lock-free.

void `size_type`

Allocate n nodes for freelist

thread-safe, may block if memory allocator blocks

only valid if no capacity<> argument given

void `size_type`

Allocate n nodes for freelist

not thread-safe, may block if memory allocator blocks

only valid if no capacity<> argument given

bool `T const &`

Pushes object t to the stack.

Thread-safe. If internal memory pool is exhausted and the memory pool is not fixed-sized, a new node will be allocated from the OS. This may not be lock-free.

object will be pushed to the stack, if internal node can be allocated

true, if the push operation is successful.

`if` memory allocator throws

bool `T const &`

Pushes object t to the stack.

Thread-safe and non-blocking. If internal memory pool is exhausted, the push operation will fail

object will be pushed to the stack, if internal node can be allocated

true, if the push operation is successful.

ConstIterator `ConstIterator` `ConstIterator`

Pushes as many objects from the range [begin, end) as freelist node can be allocated.

Operation is applied atomically

Thread-safe. If internal memory pool is exhausted and the memory pool is not fixed-sized, a new node will be allocated from the OS. This may not be lock-free.

iterator to the first element, which has not been pushed

`if` memory allocator throws

ConstIterator `ConstIterator` `ConstIterator`

Pushes as many objects from the range [begin, end) as freelist node can be allocated.

Operation is applied atomically

Thread-safe and non-blocking. If internal memory pool is exhausted, the push operation will fail

iterator to the first element, which has not been pushed

`if` memory allocator throws

bool `T const &`

Pushes object t to the stack.

Not thread-safe. If internal memory pool is exhausted and the memory pool is not fixed-sized, a new node will be allocated from the OS. This may not be lock-free.

object will be pushed to the stack, if internal node can be allocated

true, if the push operation is successful.

`if` memory allocator throws

ConstIterator `ConstIterator` `ConstIterator`

Pushes as many objects from the range [begin, end) as freelist node can be allocated.

Not thread-safe. If internal memory pool is exhausted and the memory pool is not fixed-sized, a new node will be allocated from the OS. This may not be lock-free.

iterator to the first element, which has not been pushed

`if` memory allocator throws

bool `T &`

Pops object from stack.

Thread-safe and non-blocking

if pop operation is successful, object will be copied to ret.

true, if the pop operation is successful, false if stack was empty.

bool `U &`

Pops object from stack.

Thread-safe and non-blocking

type T must be convertible to U

if pop operation is successful, object will be copied to ret.

true, if the pop operation is successful, false if stack was empty.

bool `T &`

Pops object from stack.

Not thread-safe, but non-blocking

if pop operation is successful, object will be copied to ret.

true, if the pop operation is successful, false if stack was empty.

bool `U &`

Pops object from stack.

Not thread-safe, but non-blocking

type T must be convertible to U

if pop operation is successful, object will be copied to ret.

true, if the pop operation is successful, false if stack was empty.

bool `Functor &`

consumes one element via a functor

pops one element from the stack and applies the functor on this object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

true, if one element was consumed

bool `Functor const &`

consumes one element via a functor

pops one element from the stack and applies the functor on this object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

size_t `Functor &`

consumes all elements via a functor

sequentially pops all elements from the stack and applies the functor on each object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

number of elements that are consumed

size_t `Functor const &`

consumes all elements via a functor

sequentially pops all elements from the stack and applies the functor on each object

Thread-safe and non-blocking, if functor is thread-safe and non-blocking

bool `void`

It only guarantees that at some point during the execution of the function the stack has been empty. It is rarely practical to use this value in program logic, because the stack can be modified by other threads.

true, if stack is empty.

void

Destroys stack, free all nodes from freelist.

not thread-safe