WaitHandleExtensionsWaitOneAsync(WaitHandle, Int32, CancellationToken) Method

Waits for a signal asynchronously on the provided handle.

Definition

Namespace: KGySoft.Threading
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public static Task<bool> WaitOneAsync(
	this WaitHandle handle,
	int timeout = -1,
	CancellationToken cancellationToken = default
)

Parameters

handle  WaitHandle
The handle to wait on.
timeout  Int32  (Optional)
The timeout in milliseconds. This parameter is optional.
Default value: Timeout.Infinite
cancellationToken  CancellationToken  (Optional)
A token for cancellation. This parameter is optional.
Default value: CancellationToken.None

Return Value

TaskBoolean
, if the specified handle receives a signal before timing out or canceling; otherwise, .

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type WaitHandle. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also