The Nito.AsyncEx library includes many types and extension methods. To avoid conflicts, all of these types are defined in the Nito.AsyncEx
Asynchronous Coordination Primitives
There is a whole suite of async
-ready coordination primitives. Cancellation is supported for all asynchronous operations that change state.
Most people just need AsyncLock
, but Nito.AsyncEx also includes AsyncManualResetEvent
, and AsyncReaderWriterLock
Asynchronous and Concurrent Collections
is an async
-ready producer/consumer queue that works on all platforms.AsyncCollection
is an async
-compatible wrapper around IProducerConsumerCollection
, in the same way that BlockingCollection
is a blocking wrapper around IProducerConsumerCollection
You can also use ProducerProgress
to send IProgress
updates to a producer/consumer collection.
Utility Types and Methods
class provides support for asynchronous lazy initialization
You can use IEnumerable<Task<T>>.OrderByCompletion
to order tasks by when they complete.
class and the related AsyncContextThread
class provide contexts for asynchronous operations for situations where such a context is lacking (Console applications and Win32 services). Note that due to security restrictions, AsyncContext and AsyncContextThread
will not work on Silverlight or Windows Phone platforms.CancellationTokenHelpers
provides some static methods and constants for working with CancellationToken
simplifies the writing of "command-style" events that provide a GetDeferral
is a data-binding-friendly wrapper for a Task
, providing property-change notifications when the task completes.
is a non-generic version of the built-in TaskCompletionSource<TResult>
classes interoperate between Task-based Asynchronous Programming (async
) and the Asynchronous Programming Model (IAsyncResult
can also create wrapper tasks for most events.TaskCompletionSourceExtensions
, which helps interoperate between Task-based Asynchronous Programming (async
) and Event-based Asynchronous Programming (*Completed
provides static constant Task<TResult>
values that are useful when taking advantage of the async fast path
You can respond to task progress updates by using one of the implementations of IProgress
, or DataflowProgress
is available as a gist
will create a task that is canceled when a CancellationToken
has several extension methods for TaskCompletionSource
, including propagating results from a completed Task
, and for completing the source forcing background continuations.TaskFactoryExtensions
overloads to task factories.
There is currently only one Dataflow block in the library: FuncBlock
, which allows an async
function to provide data to a dataflow mesh with full cooperative cancellation and error propagation.
Low-Level Building Blocks
will preserve the stack trace when rethrowing any exception.
For dealing with SynchronizationContext
directly, the library provides CurrentOrDefault and SynchronizationContextSwitcher