Table of Contents

Class WaitHandleExtensions

Namespace
NanoByte.Common.Threading
Assembly
NanoByte.Common.dll

Provides extension methods for System.Threading.WaitHandle.

public static class WaitHandleExtensions
Inheritance
object
WaitHandleExtensions

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 WaitHandle

The handle to wait for.

cancellationToken CancellationToken

Used to cancel waiting for the handle.

millisecondsTimeout int

The 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.