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
handle
WaitHandleThe handle to wait for.
cancellationToken
CancellationTokenUsed to cancel waiting for the handle.
millisecondsTimeout
intThe number of milliseconds to wait, or -1 to wait indefinitely.
Remarks
Automatically handles System.Threading.AbandonedMutexException with Warn(string, Exception?).
Exceptions
- TimeoutException
millisecondsTimeout
elapsed without the handle being signalled.- OperationCanceledException
cancellationToken
was signaled while waiting for the handle.