AsyncQueue<T> Class

A thread-safe, asynchronously dequeuable queue.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Threading.AsyncQueue<T>

Namespace:  Microsoft.VisualStudio.Threading
Assembly:  Microsoft.VisualStudio.Threading (in Microsoft.VisualStudio.Threading.dll)

Syntax

'Declaration
Public Class AsyncQueue(Of T)
public class AsyncQueue<T>
generic<typename T>
public ref class AsyncQueue
type AsyncQueue<'T> =  class end
JScript does not support generic types or methods.

Type Parameters

  • T
    The type of values kept by the queue.

The AsyncQueue<T> type exposes the following members.

Constructors

  Name Description
Public method AsyncQueue<T> Initializes a new instance of AsyncQueue.

Top

Properties

  Name Description
Public property Completion The source of the task returned by Completion. This is lazily constructed.
Public property Count Gets the number of elements currently in the queue.
Protected property InitialCapacity Gets the initial capacity for the queue.
Public property IsCompleted Determines whether the queue has completed.
Public property IsEmpty Determines whether the queue is currently empty.
Protected property SyncRoot Gets the synchronization object used by this queue.

Top

Methods

  Name Description
Public method Complete Signals that no further elements will be enqueued.
Public method DequeueAsync Gets a task whose result is the element at the head of the queue.
Public method Enqueue Adds an element to the tail of the queue.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method OnCompleted Occurs when the queue is completed.
Protected method OnDequeued Occurs when a value is dequeued.
Protected method OnEnqueued Occurs when a value is enqueued.
Public method Peek Gets the value at the head of the queue without removing it from the queue.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method TryDequeue(T%) Immediately dequeues the element from the head of the queue if one is available, otherwise returns without an element.
Protected method 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.
Public method TryEnqueue Adds an element to the tail of the queue if it has not yet completed.
Public method TryPeek Gets the value at the head of the queue without removing it from the queue, if it is non-empty.

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

Microsoft.VisualStudio.Threading Namespace