Partilhar via


AsyncQueue<T> Class

Definition

A thread-safe, asynchronously dequeuable queue.

generic <typename T>
public ref class AsyncQueue
template <typename T>
[Windows::Foundation::Metadata::WebHostHidden]
class AsyncQueue
[System.Diagnostics.DebuggerDisplay("Count = {Count}, Completed = {completeSignaled}")]
public class AsyncQueue<T>
[<System.Diagnostics.DebuggerDisplay("Count = {Count}, Completed = {completeSignaled}")>]
type AsyncQueue<'T> = class
[<System.Diagnostics.DebuggerDisplay("Count = {Count}, Completed = {completeSignaled}")>]
type AsyncQueue<'T> = class
    interface ThreadingTools.ICancellationNotification
Public Class AsyncQueue(Of T)

Type Parameters

T

The type of values kept by the queue.

Inheritance
AsyncQueue<T>
Derived
Attributes

Constructors

AsyncQueue<T>()

Initializes a new instance of the AsyncQueue<T> class.

Properties

Completion

Gets a task that transitions to a completed state when Complete() is called and the queue is empty.

Count

Gets the number of elements currently in the queue.

InitialCapacity

Gets the initial capacity for the queue.

IsCompleted

Gets a value indicating whether the queue is both empty and had Complete() invoked.

IsEmpty

Gets a value indicating whether the queue is currently empty.

SyncRoot

Gets the synchronization object used by this queue.

Methods

Complete()

Signals that no further elements will be enqueued.

DequeueAsync(CancellationToken)

Gets a task whose result is the element at the head of the queue.

Enqueue(T)

Adds an element to the tail of the queue.

OnCompleted()

Invoked when the queue is completed.

OnDequeued(T)

Invoked when a value is dequeued.

OnEnqueued(T, Boolean)

Invoked when a value is enqueued.

Peek()

Gets the value at the head of the queue without removing it from the queue.

ToArray()

Returns a copy of this queue as an array.

TryDequeue(Predicate<T>, T)

Immediately dequeues the element from the head of the queue if one is available that satisfies the specified check; otherwise returns without an element.

TryDequeue(T)

Immediately dequeues the element from the head of the queue if one is available, otherwise returns without an element.

TryEnqueue(T)

Adds an element to the tail of the queue if it has not yet completed.

TryPeek(T)

Gets the value at the head of the queue without removing it from the queue, if it is non-empty.

Applies to

Thread Safety

This type is thread-safe for all members.