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 (System.Threading.Mutex, System.Threading.Monitor, System.Threading.Interlocked, System.Threading.AutoResetEvent, and so on), this namespace includes a System.Threading.ThreadPool class that allows you to use a pool of system-supplied threads, and a System.Threading.Timer class that executes callback methods on thread pool threads.

Remarks

To be added.

Classes

TypeReason
AbandonedMutexException

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

ApartmentState

Specifies the apartment state of a System.Threading.Thread.

AsyncFlowControl

Provides the functionality to restore the migration, or flow, of the execution context between threads.

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 System.Threading.Barrier fails

CancellationToken

Propagates notification that operations should be canceled.

CancellationTokenRegistration

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

CancellationTokenSource

Signals to a System.Threading.CancellationToken that it should be canceled.

CompressedStack

Provides methods for setting and capturing the compressed stack on the current thread. This class cannot be inherited.

ContextCallback

Represents a method to be called within a new context.

CountdownEvent

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

EventResetMode

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

EventWaitHandle

Represents a thread synchronization event.

ExecutionContext

Manages the execution context for the current thread. This class cannot be inherited.

HostExecutionContext

Encapsulates and propagates the host execution context across threads.

HostExecutionContextManager

Provides the functionality that allows a common language runtime host to participate in the flow, or migration, of the execution context.

Interlocked

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

IOCompletionCallback

Receives the error code, number of bytes, and overlapped value type when an I/O operation completes on the thread pool.

LazyInitializer

Provides lazy initialization routines.

LazyThreadSafetyMode

Specifies how a Lazy`1 instance synchronizes access among multiple threads.

LockCookie

Defines the lock that implements single-writer/multiple-reader semantics. This is a value type.

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 System.Threading.ManualResetEvent.

Monitor

Provides a mechanism that synchronizes access to objects.

Mutex

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

NativeOverlapped

Provides 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.

Overlapped

Provides a managed representation of a Win32 OVERLAPPED structure, including methods to transfer information from an System.Threading.Overlapped instance to a System.Threading.NativeOverlapped structure.

ParameterizedThreadStart

Represents the method that executes on a System.Threading.Thread.

ReaderWriterLock

Defines a lock that supports single writers and multiple readers.

ReaderWriterLockSlim

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

RegisteredWaitHandle

Represents a handle that has been registered when calling System.Threading.ThreadPool.RegisterWaitForSingleObject(System.Threading.WaitHandle, System.Threading.WaitOrTimerCallback, object, uint, bool). This class cannot be inherited.

Semaphore

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

SemaphoreFullException

The exception that is thrown when the erload:System.Threading.Semaphore.Release method is called on a semaphore whose count is already at the maximum.

SemaphoreSlim

A lightweight alternative to System.Threading.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.

Thread

Creates and controls a thread, sets its priority, and gets its status.

ThreadAbortException

The exception that is thrown when a call is made to the System.Threading.Thread.Abort(object) method. This class cannot be inherited.

ThreadExceptionEventArgs

Provides data for the System.Windows.Forms.Application.ThreadException event.

ThreadExceptionEventHandler

Represents the method that will handle the System.Windows.Forms.Application.ThreadException event of an System.Windows.Forms.Application.

ThreadInterruptedException

The exception that is thrown when a System.Threading.Thread is interrupted while it is in a waiting state.

ThreadLocal<T>

Provides thread-local storage of data.

ThreadPool

Provides 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.

ThreadPriority

Specifies the scheduling priority of a System.Threading.Thread.

ThreadStart

Represents the method that executes on a System.Threading.Thread.

ThreadStartException

The 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.

ThreadState

Specifies the execution states of a System.Threading.Thread.

ThreadStateException

The exception that is thrown when a System.Threading.Thread is in an invalid System.Threading.Thread.ThreadState for the method call.

Timeout

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

Timer

Provides a mechanism for executing a method at specified intervals. This class cannot be inherited.

TimerCallback

Represents the method that handles calls from a System.Threading.Timer.

Volatile

Contains methods for performing volatile memory operations.

WaitCallback

Represents a callback method to be executed by a thread pool thread.

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.

WaitOrTimerCallback

Represents a method to be called when a System.Threading.WaitHandle is signaled or times out.