Table of Contents

Class BlockingQueue<T>

Namespace
Ecng.Collections
Assembly
Ecng.Collections.dll

Represents a thread-safe blocking queue implementation for storing and retrieving items of type T.

public sealed class BlockingQueue<T> : BaseBlockingQueue<T, QueueEx<T>>, ISynchronizedCollection<T>, ISynchronizedCollection, ICollection<T>, IEnumerable<T>, IEnumerable, IBlockingQueue<T>

Type Parameters

T

The type of elements in the queue.

Inheritance
BlockingQueue<T>
Implements
Inherited Members
Extension Methods

Constructors

BlockingQueue()

Initializes a new instance of the BlockingQueue<T> class with an empty underlying queue.

public BlockingQueue()

Methods

OnDequeue()

Removes and returns the item at the head of the underlying queue.

protected override T OnDequeue()

Returns

T

The dequeued item.

OnEnqueue(T, bool)

Adds an item to the underlying queue.

protected override void OnEnqueue(T item, bool force)

Parameters

item T

The item to enqueue.

force bool

If true, forces the item to be enqueued even if the queue is full; otherwise, respects the maximum size limit.

OnPeek()

Retrieves, but does not remove, the item at the head of the underlying queue.

protected override T OnPeek()

Returns

T

The item at the head of the queue.