Class WaitHandleExtensions
Provides extension methods for System.Threading.WaitHandle.
public static class WaitHandleExtensions
- Inheritance
-
objectWaitHandleExtensions
Methods
WaitOne(WaitHandle, CancellationToken, int)
Waits for the handle to be signalled.
public static void WaitOne(this WaitHandle handle, CancellationToken cancellationToken, int millisecondsTimeout = -1)
Parameters
handleWaitHandleThe handle to wait for.
cancellationTokenCancellationTokenUsed to cancel waiting for the handle.
millisecondsTimeoutintThe number of milliseconds to wait, or -1 to wait indefinitely.
Remarks
Automatically handles System.Threading.AbandonedMutexException with Warn(string, Exception?).
Exceptions
- TimeoutException
millisecondsTimeoutelapsed without the handle being signalled.- OperationCanceledException
cancellationTokenwas signaled while waiting for the handle.