public class WaitHandle { public WaitHandle(); public virtual int GetHandle(); [SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.UnmanagedCode)] public virtual void SetHandle(int handle); public virtual bool WaitOne (int millisecondsTimeout, bool exitContext); public virtual bool WaitOne (TimeSpan timeout, bool exitContext); public virtual bool WaitOne (); public static bool WaitAll( WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext); public static bool WaitAll( WaitHandle[] waitHandles, TimeSpan timeout, bool exitContext); public static bool WaitAll(WaitHandle[] waitHandles); public static int WaitAny( WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext); public static int WaitAny( WaitHandle[] waitHandles, TimeSpan timeout, bool exitContext); public static int WaitAny(WaitHandle[] waitHandles); public void Close(); }
Notes:
Close the OS handle.
Construct a new WaitHandle object.
Return the native OS handle.
Set the native OS handle.
Waits for the WaitHandle to be signaled. timeout indicates how long to wait before the method returns. If exitContext is true then the synchronization domain for the context (if in a synchronized context) is exited before the wait and reacquired
Takes an array of WaitHandles and a timeout in milliseconds. Returns when the wait terminates, either when all the objects are signaled or timeout occured. On some implementations if more that 64 Objects are passed a NotSupportedException is thrown. If there are duplicates in the array the call will fail.
If exitContext is true then the synchronization domain for the context (if in a synchronized context) is exited before the wait and reacquired
Shorthand for WaitAll with timeout = Timeout.Infinite and exitContext = true
Shorthand for WaitAll with exitContext = true
Takes an array of WaitHandles and a timeout. Returns when the wait terminates, either when any of the handles are signaled or timeout occured. The return value indicates the array index of the object that satisfied the wait. If more than one object became signaled during the call, this is the array index of the signaled object with the smallest index value of all the signalled objects. On some implementations if more that 64 Objects are passed a NotSupportedException is thrown. If there are duplicates in the array the call will fail.
If exitContext is true then the synchronization domain for the context (if in a synchronized context) is exited before the wait and reacquired
Shorthand for WaitAny with timeout = Timeout.Infinite and exitContext = true
Shorthand for WaitAny with exitContext = true