boost::parameter::template_keyword< tag::allocator, Alloc >Defines the allocator type of a data structure.
size_t
boost::parameter::template_keyword< tag::capacity, boost::mpl::size_t< Size > >Sets the capacity of a data structure at compile-time.This implies that a data structure is bounded and fixed-sized.
bool
boost::parameter::template_keyword< tag::fixed_sized, boost::mpl::bool_< IsFixedSized > >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.
typename ...
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.
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
voidConstruct queue.
unspecified
allocator const &
size_typeConstruct queue, allocate n nodes for the freelist.
size_typeunspecified
T
implementation_defined::allocator
implementation_defined::size_type
boolvoid
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.
voidsize_type
voidsize_type
boolvoidCheck 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
boolT 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.
boolT 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
boolT 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
boolT &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.
boolT &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 functorpops 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 functorpops 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
size_t
Functor &consumes all elements via a functorsequentially 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 functorsequentially 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
voidDestroys 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
typename ...
allocator_arg
std::size_t
voidConstructs a spsc_queue
spsc_queue must be configured to be sized at compile-time
unspecified
allocator const &
size_typeConstructs a spsc_queue for element_count elements
spsc_queue must be configured to be sized at run-time
size_typeunspecified
size_typeallocator_arg const &
T
implementation_defined::allocator
implementation_defined::size_type
boolT 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.
boolPops 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_typeT const *size_typePushes 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
ConstIteratorConstIteratorPushes 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_typeT *size_typePops 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
OutputIteratorPops 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 functorpops 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 functorpops 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
size_type
Functor &consumes all elements via a functorsequentially 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 functorsequentially 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_typeget 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_typeget 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 queueAvailability 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 queueAvailability 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
voidvoidreset the ringbufferNot 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
typename ...
node_allocator
std::size_t
typename ...
unspecified
handle_t
const T
T const &
voidConstruct stack.
unspecified
allocator const &
size_typeConstruct stack, allocate n nodes for the freelist.
size_typeunspecified
boost::is_copy_constructible< T >::value
(mpl::if_c< has_capacity, mpl::bool_< capacity - 1< boost::integer_traits< boost::uint16_t >::const_max >, mpl::true_ >::type::value)
stack(stack const &)
boolvoid
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.
voidsize_typeAllocate n nodes for freelist
thread-safe, may block if memory allocator blocks
only valid if no capacity<> argument given
voidsize_typeAllocate n nodes for freelist
not thread-safe, may block if memory allocator blocks
only valid if no capacity<> argument given
voidvoid
voidnode *node *
voidnode *node *
tuple< node *, node * >
bool
bool
ConstIteratorConstIteratorConstIterator &
bool
bool
T const &
ConstIterator
bool
ConstIteratorConstIterator
voidDestroys stack, free all nodes from freelist.not thread-safe
boolT 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
boolT 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
ConstIteratorConstIteratorPushes 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
ConstIteratorConstIteratorPushes 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
boolT 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
ConstIteratorConstIteratorPushes 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
boolT &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.
boolT &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 functorpops 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 functorpops 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
size_t
Functor &consumes all elements via a functorsequentially 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 functorsequentially 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 &consumes all elements via a functoratomically 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 functoratomically 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 &consumes all elements via a functoratomically pops all elements from the stack and applies the functor on each object in reversed order
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 functoratomically pops all elements from the stack and applies the functor on each object in reversed order
Thread-safe and non-blocking, if functor is thread-safe and non-blocking
number of elements that are consumed
boolvoid
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.