Show / Hide Table of Contents

Class AsyncQueue<T>

Provides a synchronized queue which can be used from within async operations. This is primarily used for producer/consumer scenarios.

Inheritance
System.Object
AsyncQueue<T>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace:Microsoft.SqlTools.ServiceLayer.Utility
Assembly:Microsoft.SqlTools.ServiceLayer.dll
Syntax
public class AsyncQueue<T>
Type Parameters
Name Description
T The type of item contained in the queue.

Constructors

| Improve this Doc View Source

AsyncQueue()

Initializes an empty instance of the AsyncQueue class.

Declaration
public AsyncQueue()
| Improve this Doc View Source

AsyncQueue(IEnumerable<T>)

Initializes an instance of the AsyncQueue class, pre-populated with the given collection of items.

Declaration
public AsyncQueue(IEnumerable<T> initialItems)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<T> initialItems

An IEnumerable containing the initial items with which the queue will be populated.

Properties

| Improve this Doc View Source

IsEmpty

Returns true if the queue is currently empty.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
System.Boolean

Methods

| Improve this Doc View Source

DequeueAsync()

Dequeues an item from the queue or waits asynchronously until an item is available.

Declaration
public Task<T> DequeueAsync()
Returns
Type Description
System.Threading.Tasks.Task<T>

A Task which can be awaited until a value can be dequeued.

| Improve this Doc View Source

DequeueAsync(CancellationToken)

Dequeues an item from the queue or waits asynchronously until an item is available. The wait can be cancelled using the given CancellationToken.

Declaration
public Task<T> DequeueAsync(CancellationToken cancellationToken)
Parameters
Type Name Description
System.Threading.CancellationToken cancellationToken

A CancellationToken with which a dequeue wait can be cancelled.

Returns
Type Description
System.Threading.Tasks.Task<T>

A Task which can be awaited until a value can be dequeued.

| Improve this Doc View Source

EnqueueAsync(T)

Enqueues an item onto the end of the queue.

Declaration
public Task EnqueueAsync(T item)
Parameters
Type Name Description
T item

The item to be added to the queue.

Returns
Type Description
System.Threading.Tasks.Task

A Task which can be awaited until the synchronized enqueue operation completes.

  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2016 Microsoft
Generated by DocFX