.NET Framework Class Library
System.Threading Namespace

The System.Threading namespace provides classes and interfaces that enable multithreaded programming. In addition to classes for synchronizing thread activities and access to data ( Mutex, Monitor, Interlocked, AutoResetEvent, and so on), this namespace includes a ThreadPool class that allows you to use a pool of system-supplied threads, and a Timer class that executes callback methods on thread pool threads.

Classes
  ClassDescription
Public class Supported by Portable Class Library AbandonedMutexExceptionThe exception that is thrown when one thread acquires a Mutex object that another thread has abandoned by exiting without releasing it.
Public class AsyncLocalTRepresents ambient data that is local to a given asynchronous control flow, such as an asynchronous method.
Public class Supported by Portable Class Library AutoResetEventNotifies a waiting thread that an event has occurred. This class cannot be inherited.
Public class Supported by Portable Class Library BarrierEnables multiple tasks to cooperatively work on an algorithm in parallel through multiple phases.
Public class Supported by Portable Class Library BarrierPostPhaseExceptionThe exception that is thrown when the post-phase action of a Barrier fails
Public class Supported by Portable Class Library CancellationTokenSourceSignals to a CancellationToken that it should be canceled.
Public class CompressedStackProvides methods for setting and capturing the compressed stack on the current thread. This class cannot be inherited.
Public class Supported by Portable Class Library CountdownEventRepresents a synchronization primitive that is signaled when its count reaches zero.
Public class Supported by Portable Class Library EventWaitHandleRepresents a thread synchronization event.
Public class ExecutionContextManages the execution context for the current thread. This class cannot be inherited.
Public class HostExecutionContextEncapsulates and propagates the host execution context across threads.
Public class HostExecutionContextManagerProvides the functionality that allows a common language runtime host to participate in the flow, or migration, of the execution context.
Public class Supported by Portable Class Library InterlockedProvides atomic operations for variables that are shared by multiple threads.
Public class Supported by Portable Class Library LazyInitializerProvides lazy initialization routines.
Public class Supported by Portable Class Library LockRecursionExceptionThe exception that is thrown when recursive entry into a lock is not compatible with the recursion policy for the lock.
Public class Supported by Portable Class Library ManualResetEventNotifies one or more waiting threads that an event has occurred. This class cannot be inherited.
Public class Supported by Portable Class Library ManualResetEventSlimProvides a slimmed down version of ManualResetEvent.
Public class Supported by Portable Class Library MonitorProvides a mechanism that synchronizes access to objects.
Public class Supported by Portable Class Library MutexA synchronization primitive that can also be used for interprocess synchronization.
Public class OverlappedProvides a managed representation of a Win32 OVERLAPPED structure, including methods to transfer information from an Overlapped instance to a NativeOverlapped structure.
Public class ReaderWriterLockDefines a lock that supports single writers and multiple readers.
Public class Supported by Portable Class Library ReaderWriterLockSlimRepresents a lock that is used to manage access to a resource, allowing multiple threads for reading or exclusive access for writing.
Public class RegisteredWaitHandleRepresents a handle that has been registered when calling RegisterWaitForSingleObject. This class cannot be inherited.
Public class Supported by Portable Class Library SemaphoreLimits the number of threads that can access a resource or pool of resources concurrently.
Public class Supported by Portable Class Library SemaphoreFullExceptionThe exception that is thrown when the SemaphoreRelease method is called on a semaphore whose count is already at the maximum.
Public class Supported by Portable Class Library SemaphoreSlimRepresents a lightweight alternative to Semaphore that limits the number of threads that can access a resource or pool of resources concurrently.
Public class Supported by Portable Class Library SynchronizationContextProvides the basic functionality for propagating a synchronization context in various synchronization models.
Public class Supported by Portable Class Library SynchronizationLockExceptionThe 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.
Public class Supported by Portable Class Library ThreadCreates and controls a thread, sets its priority, and gets its status. To browse the .NET Framework source code for this type, see the Reference Source.
Public class ThreadAbortExceptionThe exception that is thrown when a call is made to the Abort method. This class cannot be inherited.
Public class ThreadExceptionEventArgsProvides data for the ThreadException event.
Public class ThreadInterruptedExceptionThe exception that is thrown when a Thread is interrupted while it is in a waiting state.
Public class Supported by Portable Class Library ThreadLocalTProvides thread-local storage of data.
Public class Supported by Portable Class Library ThreadPoolProvides a pool of threads that can be used to execute tasks, post work items, process asynchronous I/O, wait on behalf of other threads, and process timers.
Public class ThreadStartExceptionThe exception that is thrown when a failure occurs in a managed thread after the underlying operating system thread has been started, but before the thread is ready to execute user code.
Public class ThreadStateExceptionThe exception that is thrown when a Thread is in an invalid ThreadState for the method call.
Public class Supported by Portable Class Library TimeoutContains constants that specify infinite time-out intervals. This class cannot be inherited.
Public class Supported by Portable Class Library TimerProvides a mechanism for executing a method at specified intervals. This class cannot be inherited.To browse the .NET Framework source code for this type, see the Reference Source.
Public class VolatileContains methods for performing volatile memory operations.
Public class Supported by Portable Class Library WaitHandleEncapsulates operating system–specific objects that wait for exclusive access to shared resources.
Public class Supported by Portable Class Library WaitHandleCannotBeOpenedExceptionThe exception that is thrown when an attempt is made to open a system mutex or semaphore that does not exist.
Public class WaitHandleExtensionsProvides convenience methods to for working with a safe handle for a wait handle.
Structures
  StructureDescription
Public structure AsyncFlowControlProvides the functionality to restore the migration, or flow, of the execution context between threads.
Public structure AsyncLocalValueChangedArgsTThe class that provides data change information to AsyncLocalT instances that register for change notifications.
Public structure Supported by Portable Class Library CancellationTokenPropagates notification that operations should be canceled.
Public structure Supported by Portable Class Library CancellationTokenRegistrationRepresents a callback delegate that has been registered with a CancellationToken.
Public structure LockCookieDefines the lock that implements single-writer/multiple-reader semantics. This is a value type.
Public structure NativeOverlappedProvides an explicit layout that is visible from unmanaged code and that will have the same layout as the Win32 OVERLAPPED structure with additional reserved fields at the end.
Public structure Supported by Portable Class Library SpinLockProvides a mutual exclusion lock primitive where a thread trying to acquire the lock waits in a loop repeatedly checking until the lock becomes available.
Public structure Supported by Portable Class Library SpinWaitProvides support for spin-based waiting.
Delegates
  DelegateDescription
Public delegate ContextCallbackRepresents a method to be called within a new context.
Public delegate IOCompletionCallbackReceives the error code, number of bytes, and overlapped value type when an I/O operation completes on the thread pool.
Public delegate ParameterizedThreadStartRepresents the method that executes on a Thread.
Public delegate Supported by Portable Class Library SendOrPostCallbackRepresents a method to be called when a message is to be dispatched to a synchronization context.
Public delegate ThreadExceptionEventHandlerRepresents the method that will handle the ThreadException event of an Application.
Public delegate ThreadStartRepresents the method that executes on a Thread.
Public delegate Supported by Portable Class Library TimerCallbackRepresents the method that handles calls from a Timer.
Public delegate Supported by Portable Class Library WaitCallbackRepresents a callback method to be executed by a thread pool thread.
Public delegate WaitOrTimerCallbackRepresents a method to be called when a WaitHandle is signaled or times out.
Enumerations
  EnumerationDescription
Public enumeration ApartmentStateSpecifies the apartment state of a Thread.
Public enumeration Supported by Portable Class Library EventResetModeIndicates whether an EventWaitHandle is reset automatically or manually after receiving a signal.
Public enumeration Supported by Portable Class Library LazyThreadSafetyModeSpecifies how a SystemLazyT instance synchronizes access among multiple threads.
Public enumeration Supported by Portable Class Library LockRecursionPolicySpecifies whether a lock can be entered multiple times by the same thread.
Public enumeration ThreadPrioritySpecifies the scheduling priority of a Thread.
Public enumeration ThreadStateSpecifies the execution states of a Thread.