共用方式為


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

  Class Description
Public class AsyncAutoResetEvent An asynchronous implementation of an AutoResetEvent.
Public class AsyncBarrier An asynchronous barrier that blocks the signaler until all the other participants have signaled.
Public class AsyncCountdownEvent An asynchronous countdown event.
Public class AsyncLazy<T> A thread-safe, lazily and asynchronously evaluated value factory.
Public class AsyncLocal<T> Stores reference types in the CallContext so that they can be marshaled safely.
Public class AsyncManualResetEvent A flavor of ManualResetEvent that can be asynchronously awaited.
Public class AsyncQueue<T> A thread-safe, asynchronously dequeuable queue.
Public class AsyncReaderWriterLock Microsoft internal only. A non-blocking lock that allows concurrent access, exclusive access, or concurrent access that can be upgraded to exclusive access.
Public class AsyncReaderWriterLock.Awaiter Microsoft internal only. Manages asynchronous access to a lock..
Public class AsyncReaderWriterResourceLock<TMoniker, TResource> Microsoft internal only. 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.
Public class AsyncSemaphore An asynchronous class like SemaphoreSlim with more convenient release syntax.
Public class AwaitExtensions Extension methods and awaitables for .NET.
Public class DelegatingJoinableTaskFactory A JoinableTaskFactory base class for derived types that delegate some of their work to an existing instance.
Public class HangReportContribution A contribution to an aggregate hang report.
Public class JoinableTask Tracks asynchronous operations and allows you to join asynchronous operations to avoid deadlocks while synchronously blocking the Main thread until the completion of the operation.
Public class JoinableTask<T> Tracks asynchronous operations and allows you to Join asynchronous operations. This is to avoid deadlocks while synchronously blocking the Main thread until the completion of the operation.
Public class JoinableTaskCollection A joinable collection of jobs.
Public class JoinableTaskContext A common context within which joinable tasks may be created and interact to avoid deadlocks.
Public class JoinableTaskContextNode A customizable source of JoinableTaskFactory instances.
Public class 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.
Public class NoMessagePumpSyncContext A SynchronizationContext whose synchronously-blocking Wait method does not allow any re-entrancy via the message pump.
Public class ProgressWithCompletion<T> An incremental progress reporting mechanism that also allows asynchronous awaiting for all reports to be processed.
Public class ThreadingTools Utility methods for working across threads.
Public class TplExtensions Extensions to the Task Parallel Library.

Structures

  Structure Description
Public structure AsyncReaderWriterLock.Awaitable Microsoft internal only. An awaitable that is returned from asynchronous lock requests.
Protected structure AsyncReaderWriterLock.LockHandle Microsoft internal only. A "public" representation of a specific lock.
Public structure AsyncReaderWriterLock.Releaser Microsoft internal only. A value whose disposal releases a held lock.
Public structure AsyncReaderWriterLock.Suppression Microsoft internal only. A value whose disposal restores visibility of any locks held by the caller.
Public structure AsyncReaderWriterResourceLock<TMoniker, TResource>.ResourceAwaitable Microsoft internal only. An awaitable that is returned from asynchronous lock requests.
Public structure AsyncReaderWriterResourceLock<TMoniker, TResource>.ResourceAwaiter Microsoft internal only. Manages asynchronous access to a lock.
Public structure AsyncReaderWriterResourceLock<TMoniker, TResource>.ResourceReleaser Microsoft internal only. A value whose disposal releases a held lock.
Public structure AsyncSemaphore.Releaser A value whose disposal triggers the release of a lock.
Public structure AwaitExtensions.TaskSchedulerAwaitable An awaitable that executes continuations on the specified task scheduler.
Public structure AwaitExtensions.TaskSchedulerAwaiter An awaiter returned from GetAwaiter.
Public structure JoinableTaskCollection.JoinRelease A value whose disposal cancels a Join operation.
Public structure JoinableTaskContext.RevertRelevance A structure that clears the CallContext and SynchronizationContext async/thread values and restores those values when this structure is disposed.
Public structure JoinableTaskFactory.MainThreadAwaitable An awaitable struct that facilitates an asynchronous transition to the Main thread.
Public structure JoinableTaskFactory.MainThreadAwaiter An awaiter struct that facilitates an asynchronous transition to the main thread.
Public structure SpecializedSyncContext A structure that applies and reverts changes to the SynchronizationContext.
Public structure TplExtensions.NoThrowTaskAwaitable An awaitable that wraps a task and never throws an exception when waited on.
Public structure TplExtensions.NoThrowTaskAwaiter An awaiter that wraps a task and never throws an exception when waited on.

Interfaces

  Interface Description
Public interface IAsyncDisposable Defines an asynchronous method to release allocated resources.
Public interface IHangReportContributor Provides a facility to produce reports that may be useful when analyzing hangs.

Delegates

  Delegate Description
Public delegate AsyncEventHandler An asynchronous event handler.
Public delegate AsyncEventHandler<T> An asynchronous event handler.

Enumerations

  Enumeration Description
Public enumeration AsyncReaderWriterLock.LockFlags Microsoft internal only. Flags that modify the default lock behavior.
Public enumeration AsyncReaderWriterResourceLock<TMoniker, TResource>.LockFlags Microsoft internal only. Flags that modify the default lock behavior.