Condividi tramite


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.
  • Mutexes
    Explains how to use a Mutex to synchronize access to an object or to build your own synchronization mechanisms.
  • Semaphores
    Describes Semaphore objects and explains how to use them to control access to limited resources.

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