Microsoft.VisualStudio.Threading Namespace

The Microsoft.VisualStudio.Threading namespace contains APIs for use in Visual Studio SDK projects. You should use these APIs for asynchronous programming in Visual Studio. Doing so helps you avoid deadlocks

This library is based on the .NET Framework Task Parallel Library (TPL). For information about this library, see Task Parallel Library (TPL).

Classes

AsyncAutoResetEvent

An asynchronous implementation of an AutoResetEvent.

AsyncBarrier

An asynchronous barrier that blocks the signaler until all other participants have signaled.

AsyncCountdownEvent

An asynchronous style countdown event.

AsyncLazy<T>

A thread-safe, lazily and asynchronously evaluated value factory.

AsyncLazyInitializer

Lazily executes a delegate that has some side effect (typically initializing something) such that the delegate runs at most once.

AsyncLocal<T>

Stores references such that they are available for retrieval in the same call context.

AsyncManualResetEvent

A flavor of ManualResetEvent that can be asynchronously awaited on.

AsyncQueue<T>

A thread-safe, asynchronously dequeuable queue.

AsyncReaderWriterLock

A non-blocking lock that allows concurrent access, exclusive access, or concurrent with upgradeability to exclusive access.

AsyncReaderWriterLock.Awaiter

Manages asynchronous access to a lock.

AsyncReaderWriterResourceLock<TMoniker,TResource>

A non-blocking lock that allows concurrent access, exclusive access, or concurrent with upgradeability to exclusive access, making special allowances for resources that must be prepared for concurrent or exclusive access.

AsyncSemaphore

An asynchronous SemaphoreSlim like class with more convenient release syntax.

AwaitExtensions

Extension methods and awaitables for .NET 4.5.

CancellationTokenExtensions

Extensions to CancellationToken.

DelegatingJoinableTaskFactory

A JoinableTaskFactory base class for derived types that delegate some of their work to an existing instance.

DispatcherExtensions

Extension methods for the WPF Dispatcher for better interop with the JoinableTaskFactory.

HangReportContribution

A contribution to an aggregate hang report.

IllegalSemaphoreUsageException

Exception which is thrown when the contract of a ReentrantSemaphore is violated.

JoinableTask

Tracks asynchronous operations and provides the ability to Join those operations to avoid deadlocks while synchronously blocking the Main thread for the operation's completion.

JoinableTask<T>

Tracks asynchronous operations and provides the ability to Join those operations to avoid deadlocks while synchronously blocking the Main thread for the operation's completion.

JoinableTaskCollection

A collection of incomplete JoinableTask objects.

JoinableTaskContext

A common context within which joinable tasks may be created and interact to avoid deadlocks.

JoinableTaskContext.HangDetails

A class to encapsulate the details of a possible hang. An instance of this JoinableTaskContext.HangDetails class will be passed to the JoinableTaskContextNode instances who registered the hang notifications.

JoinableTaskContextException

An exception thrown when the configuration provided to the JoinableTaskContext are incorrect or a virtual method is overridden such that it violates a contract. This exception should not be caught. It is thrown when the application has a programming fault.

JoinableTaskContextNode

A customizable source of JoinableTaskFactory instances.

JoinableTaskFactory

A factory for starting asynchronous tasks that can mitigate deadlocks when the tasks require the Main thread of an application and the Main thread may itself be blocking on the completion of a task.

NoMessagePumpSyncContext

A SynchronizationContext whose synchronously blocking Wait method does not allow any reentrancy via the message pump.

NonConcurrentSynchronizationContext

A SynchronizationContext that executes messages in the order they are received.

ProgressWithCompletion<T>

An incremental progress reporting mechanism that also allows asynchronous awaiting for all reports to be processed.

ReentrantSemaphore

A JoinableTaskFactory-aware semaphore that allows reentrancy without consuming another slot in the semaphore.

SemaphoreFaultedException

Exception thrown when a ReentrantSemaphore is in a faulted state.

SingleThreadedSynchronizationContext

A single-threaded synchronization context, akin to the DispatcherSynchronizationContext and WindowsFormsSynchronizationContext.

SingleThreadedSynchronizationContext.Frame

A message pumping frame that may be pushed with PushFrame(SingleThreadedSynchronizationContext+Frame) to pump messages on the owning thread.

ThreadingTools

Utility methods for working across threads.

TplExtensions

Extensions to the Task Parallel Library.

Structs

AsyncReaderWriterLock.Awaitable

An awaitable that is returned from asynchronous lock requests.

AsyncReaderWriterLock.LockHandle

A "public" representation of a specific lock.

AsyncReaderWriterLock.Releaser

A value whose disposal releases a held lock.

AsyncReaderWriterLock.Suppression

A value whose disposal restores visibility of any locks held by the caller.

AsyncReaderWriterResourceLock<TMoniker,TResource>.ResourceAwaitable

An awaitable that is returned from asynchronous lock requests.

AsyncReaderWriterResourceLock<TMoniker,TResource>.ResourceAwaiter

Manages asynchronous access to a lock.

AsyncReaderWriterResourceLock<TMoniker,TResource>.ResourceReleaser

A value whose disposal releases a held lock.

AsyncSemaphore.Releaser

A value whose disposal triggers the release of a lock.

AwaitExtensions.AggregateExceptionAwaitable

The result of ConfigureAwaitForAggregateException(Task, Boolean) to prepare a Task to be awaited while throwing with all inner exceptions.

AwaitExtensions.AggregateExceptionAwaiter

The result of GetAwaiter() to prepare a Task to be awaited while throwing with all inner exceptions.

AwaitExtensions.ConfiguredTaskYieldAwaitable

An awaitable that will always lead the calling async method to yield, then immediately resume, possibly on the original SynchronizationContext.

AwaitExtensions.ConfiguredTaskYieldAwaiter

An awaiter that will always lead the calling async method to yield, then immediately resume, possibly on the original SynchronizationContext.

AwaitExtensions.ExecuteContinuationSynchronouslyAwaitable

A Task awaitable that has affinity to executing callbacks synchronously on the completing callstack.

AwaitExtensions.ExecuteContinuationSynchronouslyAwaitable<T>

A Task awaitable that has affinity to executing callbacks synchronously on the completing callstack.

AwaitExtensions.ExecuteContinuationSynchronouslyAwaiter

A Task awaiter that has affinity to executing callbacks synchronously on the completing callstack.

AwaitExtensions.ExecuteContinuationSynchronouslyAwaiter<T>

A Task awaiter that has affinity to executing callbacks synchronously on the completing callstack.

AwaitExtensions.SynchronizationContextAwaiter

An awaiter returned from GetAwaiter(SynchronizationContext).

AwaitExtensions.TaskSchedulerAwaitable

An awaitable that executes continuations on the specified task scheduler.

AwaitExtensions.TaskSchedulerAwaiter

An awaiter returned from GetAwaiter(TaskScheduler).

CancellationTokenExtensions.CombinedCancellationToken

Provides access to a CancellationToken that combines multiple other tokens, and allows convenient disposal of any applicable CancellationTokenSource.

JoinableTaskCollection.JoinRelease

A value whose disposal cancels a Join() operation.

JoinableTaskContext.RevertRelevance

A structure that clears CallContext and SynchronizationContext async/thread statics and restores those values when this structure is disposed.

JoinableTaskFactory.MainThreadAwaitable

An awaitable struct that facilitates an asynchronous transition to the Main thread.

JoinableTaskFactory.MainThreadAwaiter

An awaiter struct that facilitates an asynchronous transition to the Main thread.

ReentrantSemaphore.RevertRelevance

A structure that hides any evidence that the caller has entered a ReentrantSemaphore till this value is disposed.

SpecializedSyncContext

A structure that applies and reverts changes to the SynchronizationContext.

TplExtensions.NoThrowTaskAwaitable

An awaitable that wraps a task and never throws an exception when waited on.

TplExtensions.NoThrowTaskAwaiter

An awaiter that wraps a task and never throws an exception when waited on.

Interfaces

IAsyncDisposable

Defines an asynchronous method to release allocated resources.

IHangReportContributor

Provides a facility to produce reports that may be useful when analyzing hangs.

Enums

AsyncReaderWriterLock.LockFlags

Flags that modify default lock behavior.

AsyncReaderWriterResourceLock<TMoniker,TResource>.LockFlags

Flags that modify default lock behavior.

JoinableTaskCreationOptions

Specifies flags that control optional behavior for the creation and execution of tasks.

ReentrantSemaphore.ReentrancyMode

Describes ways the ReentrantSemaphore may behave when a semaphore request is made in a context that is already in the semaphore.

RegistryChangeNotificationFilters

The various types of data within a registry key that generate notifications when changed.

Delegates

AsyncEventHandler

An asynchronous event handler.

AsyncEventHandler<TEventArgs>

An asynchronous event handler.