Share via


WaitHandle Class

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Encapsulates operating system–specific objects that wait for exclusive access to shared resources.

Inheritance Hierarchy

System. . :: . .Object
  System. . :: . .MarshalByRefObject
    System.Threading..::..WaitHandle
      System.Threading. . :: . .AutoResetEvent
      System.Threading. . :: . .ManualResetEvent

Namespace:  System.Threading
Assembly:  mscorlib (in mscorlib.dll)

Syntax

'Declaration
Public MustInherit Class WaitHandle _
    Inherits MarshalByRefObject
public abstract class WaitHandle : MarshalByRefObject
public ref class WaitHandle abstract : public MarshalByRefObject
[<AbstractClass>]
type WaitHandle =  
    class
        inherit MarshalByRefObject
    end
public abstract class WaitHandle extends MarshalByRefObject

The WaitHandle type exposes the following members.

Constructors

  Name Description
Protected method WaitHandle Initializes a new instance of the WaitHandle class.

Top

Methods

  Name Description
Public method Equals(Object) Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public methodStatic member WaitAll(array<WaitHandle> [] () [] []) Waits for all the elements in the specified array to receive a signal.
Public methodStatic member WaitAll(array<WaitHandle> [] () [] [], Int32, Boolean) Waits for all the elements in the specified array to receive a signal, using an Int32 value to specify the time interval and specifying whether to exit the synchronization domain before the wait.
Public methodStatic member WaitAny(array<WaitHandle> [] () [] []) Waits for any of the elements in the specified array to receive a signal.
Public methodStatic member WaitAny(array<WaitHandle> [] () [] [], Int32, Boolean) Waits for any of the elements in the specified array to receive a signal, using a 32-bit signed integer to specify the time interval, and specifying whether to exit the synchronization domain before the wait.
Public method WaitOne() () () () Blocks the current thread until the current WaitHandle receives a signal.
Public method WaitOne(Int32, Boolean) Blocks the current thread until the current WaitHandle receives a signal, using a 32-bit signed integer to specify the time interval and specifying whether to exit the synchronization domain before the wait.

Top

Fields

  Name Description
Public fieldStatic member WaitTimeout Indicates that a WaitAny operation timed out before any of the wait handles were signaled. This field is constant.

Top

Remarks

This class is typically used as a base class for synchronization objects. Classes derived from WaitHandle define a signaling mechanism to indicate taking or releasing access to a shared resource, but use the inherited WaitHandle methods to block while waiting for access to shared resources.

Use the static methods of this class to block a thread until one or more synchronization objects receive a signal.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Threading Namespace