BloombergLP::bdlcc::SingleConsumerQueueImpl

This class provides a thread-safe unbounded queue of values that assumes a single consumer thread.

Synopsis

Declared in <bdlcc_singleconsumerqueueimpl.h>

template<
    class TYPE,
    class ATOMIC_OP,
    class MUTEX,
    class CONDITION>
class SingleConsumerQueueImpl;

Description

The types ATOMIC_OP, MUTEX, and CONDITION are exposed for testing. Typical usage is with bsls::AtomicOperations for ATOMIC_OP, bslmt::Mutex for MUTEX, and bslmt::Condition for CONDITION.

Type Aliases

NameDescription
value_type The type for elements stored in this queue.

Enums

NameDescription
Unnamed enum Status codes returned by queue operations.

Member Functions

NameDescription
SingleConsumerQueueImpl [constructor]Constructors
~SingleConsumerQueueImpl [destructor]Destroy this container. The behavior is undefined unless all access or modification of the container has completed prior to this call.
allocator Return the allocator used by this object to supply memory.
disablePopFront Disable dequeueing from this queue.
disablePushBack Disable enqueueing into this queue.
enablePopFront Enable dequeueing. If the queue is not dequeue disabled, this call has no effect.
enablePushBack Enable queuing. If the queue is not enqueue disabled, this call has no effect.
isEmpty Return true if this queue is empty (has no elements), or false otherwise.
isFull Return true if this queue is full (has no available capacity), or false otherwise. Note that for unbounded queues, this method always returns false.
isPopFrontDisabled Return true if this queue is dequeue disabled, and false otherwise. Note that the queue is created in the "dequeue enabled" state.
isPushBackDisabled Return true if this queue is enqueue disabled, and false otherwise. Note that the queue is created in the "enqueue enabled" state.
numElements Return the number of elements currently in this queue.
popFront Remove the front element into value, blocking until available.
pushBack pushBack overloads
removeAll Remove all items currently in this queue.
tryPopFront Attempt to remove the front element without blocking.
tryPushBack tryPushBack overloads
waitUntilEmpty Block until all elements in this queue are removed.
operator BloombergLP::bslmf::NestedTraitDeclaration<SingleConsumerQueueImpl, UsesBslmaAllocator> Declare that this type uses a bslma allocator.

Friends

NameDescription
BloombergLP::bdlcc::SingleConsumerQueueImpl_AllocateLockGuardThis class implements a guard that automatically invokes releaseAllocateLock on the managed queue upon destruction.
BloombergLP::bdlcc::SingleConsumerQueueImpl_PopCompleteGuardThis class implements a guard that automatically invokes popComplete on the managed queue upon destruction.
BloombergLP::bdlcc::SingleConsumerQueueImpl_MarkReclaimProctorThis class implements a proctor that, unless its release method has previously been invoked, automatically invokes markReclaim on a NODE upon destruction.