nn::os::BlockingQueue Class

Header file: nn/os.h

Syntax

class BlockingQueue : private nn::os::detail::BlockingQueueBase

Description

Class for handling blocking queues.

A blocking queue is a messaging mechanism that provide the ability to synchronize threads safely.

The number of elements that can be placed in the queue is limited by the size of the buffer provided during initialization. Attempting to add additional elements to the queue beyond this limit will cause the thread to block. Similarly, attempting to retrieve an element from an empty queue will cause the thread to block.

Blocking queues have the same features as what have up until now been referred to as "message queues."

Because CriticalSection sections are used internally for thread synchronization, deadlocks may occur in situations that could lead to priority inversion or other scheduling issues. When such a possibility exists, use SafeBlockingQueue instead.

Member Functions

BlockingQueue Constructor.
~BlockingQueue Destructor.
Initialize Initializes a blocking queue using the specified buffer and size.
TryInitialize Initializes a blocking queue using the specified buffer and size.
Finalize Destroys a blocking queue.
Enqueue Inserts an element at the end of the queue.
TryEnqueue Tries to insert an element at the end of the queue.
Jam Inserts an element at the front of the queue.
TryJam Tries to insert an element at the front of the queue.
Dequeue Removes the first element from the front of the queue.
TryDequeue Removes the first element from the front of the queue.
GetFront Gets the element at the front of the queue.
TryGetFront Gets the element at the front of the queue.

Class Hierarchy

ADLFireWall::NonCopyable
  nn::os::detail::BlockingQueueBase
    nn::os::BlockingQueue

Revision History

2010/01/07
Initial version.

CONFIDENTIAL