Threading Objects and Features
The .NET Framework provides a number of objects that help you create and manage multithreaded applications. Managed threads are represented by the Thread class. The ThreadPool class provides easy creation and management of multithreaded background tasks. The BackgroundWorker class does the same for tasks that interact with the user interface. The Timer class executes background tasks at timed intervals.
In addition, there are a number of classes that synchronize activities of threads, including the Semaphore and EventWaitHandle classes introduced in the .NET Framework version 2.0. The features of these classes are compared in Overview of Synchronization Primitives.
In This Section
The Managed Thread Pool
Explains the ThreadPool class, which enables you to request a thread to execute a task without having to do any thread management yourself.Timers
Explains how to use a Timer to specify a delegate to be called at a specified time.Monitors
Explains how to use the Monitor class to synchronize access to a member or to build your own thread management types.Wait Handles
Describes the WaitHandle class, the abstract base class for event wait handles, mutexes, and semaphores, which enables waiting for multiple synchronization events.EventWaitHandle, AutoResetEvent, CountdownEvent, and ManualResetEvent
Describes managed event wait handles, which are used to synchronize thread activities by signaling and waiting for signals.Mutexes
Explains how to use a Mutexto synchronize access to an object or to build your own synchronization mechanisms.Interlocked Operations
Explains how to use the Interlocked class to increment or decrement a value and store the value in a single atomic operation.Reader-Writer Locks
Defines a lock that implements single-writer/multiple-reader semantics.Semaphore and SemaphoreSlim
Describes Semaphore objects and explains how to use them to control access to limited resources.Overview of Synchronization Primitives
Compares the features of the .NET Framework classes provided for locking and synchronizing managed threads.Barrier (.NET Framework)
Describes Barrier objects that implement the barrier pattern for coordination of threads in phased operations.SpinLock
Describes SpinLock, a lightweight alternative to the Monitor class for certain low-level scenarios.Cancellation Tokens
Describes CancellationToken, which is a lightweight object that can be used to implement cooperative cancellation between threads.SpinWait
Describes SpinWait, a low level synchronization primitive that performs busy spinning prior to initiating a kernel-based wait.
Reference
Thread
Provides reference documentation for the Thread class, which represents a managed thread, whether it came from unmanaged code or was created in a managed application.BackgroundWorker
Enables background tasks that interact with the user interface, communicating via events raised on the user-interface thread.
Related Sections
Asynchronous File I/O
Describes how I/O asynchronous completion ports use the thread pool to require processing only when an input/output operation completes.Task Parallel Library
Describes the recommended approach for multithreaded programming in the .NET Framework version 4 and later.