Search Results for

    Show / Hide Table of Contents

    Class WaitHandle

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

    Inheritance
    object
    MarshalByRefObject
    WaitHandle
    AutoResetEvent
    ManualResetEvent
    Inherited Members
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    Namespace: System.Threading
    Assembly: mscorlib.dll
    Syntax
    public abstract class WaitHandle : MarshalByRefObject

    Constructors

    WaitHandle()

    Declaration
    protected WaitHandle()

    Fields

    WaitTimeout

    Indicates that a WaitAny operation timed out before any of the wait handles were signaled. This field is constant.

    Declaration
    public const int WaitTimeout = 258
    Field Value
    Type Description
    int

    Methods

    WaitAll(WaitHandle[], int, bool)

    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.

    Declaration
    public static bool WaitAll(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
    Parameters
    Type Name Description
    WaitHandle[] waitHandles

    A WaitHandle array containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object (duplicates).

    int millisecondsTimeout

    The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.

    bool exitContext

    true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false.

    Returns
    Type Description
    bool

    true when every element in waitHandles has received a signal; otherwise, false.

    WaitAll(WaitHandle[])

    Waits for all the elements in the specified array to receive a signal.

    Declaration
    public static bool WaitAll(WaitHandle[] waitHandles)
    Parameters
    Type Name Description
    WaitHandle[] waitHandles

    A WaitHandle array containing the objects for which the current instance will wait. This array cannot contain multiple references to the same object.

    Returns
    Type Description
    bool

    true when every element in waitHandles has received a signal; otherwise the method never returns.

    WaitAny(WaitHandle[], int, bool)

    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.

    Declaration
    public static int WaitAny(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext)
    Parameters
    Type Name Description
    WaitHandle[] waitHandles

    A WaitHandle array containing the objects for which the current instance will wait.

    int millisecondsTimeout

    The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.

    bool exitContext

    true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false.

    Returns
    Type Description
    int

    The array index of the object that satisfied the wait, or WaitTimeout if no object satisfied the wait and a time interval equivalent to millisecondsTimeout has passed.

    WaitAny(WaitHandle[])

    Waits for any of the elements in the specified array to receive a signal.

    Declaration
    public static int WaitAny(WaitHandle[] waitHandles)
    Parameters
    Type Name Description
    WaitHandle[] waitHandles

    A WaitHandle array containing the objects for which the current instance will wait.

    Returns
    Type Description
    int

    The array index of the object that satisfied the wait.

    WaitOne()

    Blocks the current thread until the current WaitHandle receives a signal.

    Declaration
    public virtual bool WaitOne()
    Returns
    Type Description
    bool

    true if the current instance receives a signal. If the current instance is never signaled, WaitOne never returns.

    WaitOne(int, bool)

    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.

    Declaration
    public virtual bool WaitOne(int millisecondsTimeout, bool exitContext)
    Parameters
    Type Name Description
    int millisecondsTimeout

    The number of milliseconds to wait, or Timeout.Infinite (-1) to wait indefinitely.

    bool exitContext

    true to exit the synchronization domain for the context before the wait (if in a synchronized context), and reacquire it afterward; otherwise, false.

    Returns
    Type Description
    bool

    true if the current instance receives a signal; otherwise, false.

    Extension Methods

    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    LogDispatcher.GetCurrentClassLogger(object)
    In This Article
    Back to top Copyright © 2023 nanoFramework Contributors
    Generated by DocFX