Threading Objects and Features
The .NET Framework provides a number of objects that help you create and manage multithreaded applications. WaitHandle objects help you respond to actions taken by other threads, especially when interoperating with unmanaged code. The ThreadPool provides the best basic thread creation and management mechanism for most tasks. Monitor, Mutex, Interlocked, and ReaderWriterLock objects provide mechanisms for synchronizing execution at a low level. The Timer is a flexible way to raise activities at certain intervals, and I/O asynchronous completion uses the thread pool to notify you when your I/O work has completed, freeing you to do other things in the meantime.
In This Section
- Thread Pooling
- Explains the ThreadPool class, which enables you to request a thread to execute a task without having to do any thread management yourself.
- I/O Asynchronous Completion
- Describes how I/O asynchronous completion ports use the thread pool to require processing only when an input/output operation completes.
- Explains how to use a Timer to specify a delegate to be called at a specified time.
- Explains how to use the Monitor class to synchronize access to a member or to build your own thread management types.
- Describes WaitHandle objects, which are managed representations of operating system synchronization handles.
- Explains how the ManualResetEvent is signaled when an event occurs, and how to manually reset it.
- Explains how the AutoResetEvent is signaled when an event occurs.
- Explains how to use a Mutex to synchronize access to an object or to build your own synchronization mechanisms.
- Explains how to use the Interlocked class to increment or decrement a value and store the value in a single atomic operation.
- Defines a lock that implements single-writer/multiple-reader semantics.
- 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.