System.Threading.WaitHandle.WaitOne Method

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

Syntax

public virtual bool WaitOne ()

Returns

true if the current instance receives a signal. If the current instance is never signaled, WaitHandle.WaitOne(int, bool) never returns.

Exceptions

TypeReason
ObjectDisposedExceptionThe current instance has already been disposed.

Remarks

System.Threading.AbandonedMutexException is new in the .NET Framework version 2.0. In previous versions, the erload:System.Threading.WaitHandle.WaitOne method returns true when a mutex is abandoned. An abandoned mutex often indicates a serious coding error. In the case of a system-wide mutex, it might indicate that an application has been terminated abruptly (for example, by using Windows Task Manager). The exception contains information useful for debugging.

The caller of this method blocks indefinitely until the current instance receives a signal. Use this method to block until a System.Threading.WaitHandle receives a signal from another thread, such as is generated when an asynchronous operation completes. For more information, see the IAsyncResult interface.

Calling this method overload is equivalent to calling the WaitHandle.WaitOne(int, bool) method overload and specifying -1 or Timeout.Infinite for the first parameter and false for the second parameter.

Override this method to customize the behavior of derived classes.

Requirements

Namespace: System.Threading
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0