System.Threading namespaces

The System.Threading, System.Threading.Tasks, and System.Threading.Tasks.DataFlow namespaces contain types that enable multithreaded programming and that simplify writing concurrent and asynchronous code.

This topic displays the types in the System.Threading, System.Threading.Tasks, and System.Threading.Tasks.DataFlow namespaces that are included in the .NET for Windows Store apps, or can be installed and used to create Windows Store apps. Note that the .NET for Windows Store apps does not include all the members of each type. For information about individual types, see the linked topics. The documentation for a type indicates which members are included in the .NET for Windows Store apps.

To install the System.Threading.Tasks.Dataflow namespace, open your project in Visual Studio 2012 or later, choose Manage NuGet Packages from the Project menu, and search online for the Microsoft.Tpl.Dataflow package.

Types supported in the .NET for Windows Store apps

Description

AbandonedMutexException

The exception that is thrown when one thread acquires a Mutex object that another thread has abandoned by exiting without releasing it.

AutoResetEvent

Notifies a waiting thread that an event has occurred. This class cannot be inherited.

Barrier

Enables multiple tasks to cooperatively work on an algorithm in parallel through multiple phases.

BarrierPostPhaseException

The exception that is thrown when the post-phase action of a Barrier fails.

CancellationToken

Propagates notification that operations should be canceled.

CancellationTokenRegistration

Represents a callback delegate that has been registered with a CancellationToken.

CancellationTokenSource

Signals to a CancellationToken that it should be canceled.

CountdownEvent

Represents a synchronization primitive that is signaled when its count reaches zero.

EventResetMode

Indicates whether an EventWaitHandle is reset automatically or manually after receiving a signal.

EventWaitHandle

Represents a thread synchronization event.

Interlocked

Provides atomic operations for variables that are shared by multiple threads.

LazyInitializer

Provides lazy initialization routines.

LazyThreadSafetyMode

Specifies how a Lazy<T> instance synchronizes access among multiple threads.

LockRecursionException

The exception that is thrown when recursive entry into a lock is not compatible with the recursion policy for the lock.

LockRecursionPolicy

Specifies whether a lock can be entered multiple times by the same thread.

ManualResetEvent

Notifies one or more waiting threads that an event has occurred. This class cannot be inherited.

ManualResetEventSlim

Provides a slimmed down version of ManualResetEvent.

Monitor

Provides a mechanism that synchronizes access to objects.

Mutex

A synchronization primitive that can also be used for interprocess synchronization.

ReaderWriterLockSlim

Represents a lock that is used to manage access to a resource, allowing multiple threads for reading or exclusive access for writing.

Semaphore

Limits the number of threads that can access a resource or pool of resources concurrently.

SemaphoreFullException

The exception that is thrown when the Release method is called on a semaphore whose count is already at the maximum.

SemaphoreSlim

A lightweight alternative to Semaphore that limits the number of threads that can access a resource or pool of resources concurrently.

SendOrPostCallback

Represents a method to be called when a message is to be dispatched to a synchronization context.

SpinLock

Provides a mutual exclusion lock primitive where a thread trying to acquire the lock waits in a loop repeatedly checking until the lock becomes available.

SpinWait

Provides support for spin-based waiting.

SynchronizationContext

Provides the basic functionality for propagating a synchronization context in various synchronization models.

SynchronizationLockException

The exception that is thrown when a method requires the caller to own the lock on a given Monitor, and the method is invoked by a caller that does not own that lock.

ThreadLocal<T>

Provides thread-local storage of data.

Timeout

Contains constants that specify infinite time-out intervals. This class cannot be inherited.

Volatile

Contains methods for performing volatile memory operations.

WaitHandle

Encapsulates operating system-specific objects that wait for exclusive access to shared resources.

WaitHandleCannotBeOpenedException

The exception that is thrown when an attempt is made to open a system mutex or semaphore that does not exist.

Types supported in the .NET for Windows Store apps

Description

ConcurrentExclusiveSchedulerPair

Provides concurrent and exclusive task schedulers that coordinate to execute tasks while ensuring that concurrent tasks may run concurrently and exclusive tasks never do.

Parallel

Provides support for parallel loops and regions.

ParallelLoopResult

Provides completion status on the execution of a parallel loop.

ParallelLoopState

Enables iterations of Parallel loops to interact with other iterations. An instance of this class is provided by the Parallel class to each loop; you cannot create instances in your user code.

ParallelOptions

Stores options that configure the operation of methods on the Parallel class.

Task

Represents an asynchronous operation.

Task<TResult>

Represents an asynchronous operation that can return a value.

TaskCanceledException

Represents an exception used to communicate task cancellation.

TaskCompletionSource<TResult>

Represents the producer side of a Task<TResult> unbound to a delegate, providing access to the consumer side through the TaskCompletionSource<T>.Task property.

TaskContinuationOptions

Specifies the behavior for a task that is created by using the ContinueWith or Task<T>.ContinueWith method.

TaskCreationOptions

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

TaskExtensions

Provides a set of static (Shared in Visual Basic) methods for working with specific kinds of Task instances.

TaskFactory

Provides support for creating and scheduling Task objects.

TaskFactory<TResult>

Provides support for creating and scheduling Task<T> objects.

TaskScheduler

Represents an object that handles the low-level work of queuing tasks onto threads.

TaskSchedulerException

Represents an exception used to communicate an invalid operation by a TaskScheduler.

TaskStatus

Represents the current stage in the lifecycle of a task.

UnobservedTaskExceptionEventArgs

Provides data for the event that is raised when a faulted task's exception goes unobserved.

To install the System.Threading.Tasks.Dataflow namespace, open your project in Visual Studio 2012, choose Manage NuGet Packages from the Project menu, and search online for the Microsoft.Tpl.Dataflow package.

Types supported in the .NET for Windows Store apps

Description

ActionBlock<TInput>

Provides a dataflow block that invokes a provided Action<T> delegate for every data element received.

BatchBlock<T>

Provides a dataflow block that batches inputs into arrays.

BatchedJoinBlock<T1, T2>

Provides a dataflow block that batches a specified number of inputs of potentially differing types provided to one or more of its targets.

BatchedJoinBlock<T1, T2, T3>

Provides a dataflow block that batches a specified number of inputs of potentially differing types provided to one or more of its targets.

BroadcastBlock<T>

Provides a buffer for storing at most one element at a time, overwriting each message with the next as it arrives. Messages are broadcast to all linked targets, all of which may consume a clone of the message.

BufferBlock<T>

Provides a buffer for storing data.

DataflowBlock

Provides a set of static (Shared in Visual Basic) methods for working with dataflow blocks.

DataflowBlockOptions

Provides options used to configure the processing performed by dataflow blocks.

DataflowLinkOptions

Provides options used to configure a link between dataflow blocks.

DataflowMessageHeader

Provides a container of data attributes for passing between dataflow blocks.

DataflowMessageStatus

Represents the status of a DataflowMessageHeader when passed between dataflow blocks.

ExecutionDataflowBlockOptions

Provides options used to configure the processing performed by dataflow blocks that process each message through the invocation of a user-provided delegate. These are dataflow blocks such as ActionBlock<TInput> and TransformBlock<TInput, TOutput>.

GroupingDataflowBlockOptions

Provides options used to configure the processing performed by dataflow blocks that group together multiple messages. These are dataflow blocks such as JoinBlock<T1, T2> and BatchBlock<T>.

IDataflowBlock

Represents a dataflow block.

IPropagatorBlock<TInput, TOutput>

Represents a dataflow block that is both a target for data and a source of data.

IReceivableSourceBlock<TOutput>

Represents a dataflow block that supports receiving messages without linking.

ISourceBlock<TOutput>

Represents a dataflow block that is a source of data.

ITargetBlock<TInput>

Represents a dataflow block that is a target for data.

JoinBlock<T1, T2>

Provides a dataflow block that joins across multiple dataflow sources, which are not necessarily of the same type, waiting for one item to arrive for each type before they’re all released together as a tuple that contains one item per type.

JoinBlock<T1, T2, T3>

Provides a dataflow block that joins across multiple dataflow sources, which are not necessarily of the same type, waiting for one item to arrive for each type before they’re all released together as a tuple that contains one item per type.

TransformBlock<TInput, TOutput>

Provides a dataflow block that invokes a provided Func<T, TResult> delegate for every data element received.

TransformManyBlock<TInput, TOutput>

Provides a dataflow block that invokes a provided Func<T, TResult> delegate for every data element received.

WriteOnceBlock<T>

Provides a buffer for receiving and storing at most one element in a network of dataflow blocks.

Show:
© 2014 Microsoft