Interface IAsyncEvent
Represents asynchronous event.
Inherited Members
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public interface IAsyncEvent : IDisposable, IResettable
Properties
| Edit this page View SourceIsSet
Determines whether this event in signaled state.
Declaration
bool IsSet { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
| Edit this page View SourceReset()
Changes state of this even to non-signaled.
Declaration
bool Reset()
Returns
Type | Description |
---|---|
bool | true, if state of this object changed from signaled to non-signaled state; otherwise, false. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The current instance has already been disposed. |
Signal()
Raises asynchronous event if it meets internal conditions.
Declaration
bool Signal()
Returns
Type | Description |
---|---|
bool | true, if state of this object changed from non-signaled to signaled state; otherwise, false. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The current instance has already been disposed. |
Wait(TimeSpan)
Blocks the current thread until this event is set.
Declaration
bool Wait(TimeSpan timeout)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | The time to wait for the event. |
Returns
Type | Description |
---|---|
bool |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The current instance has already been disposed. |
ArgumentOutOfRangeException |
|
WaitAsync(CancellationToken)
Suspends the caller until this event is set.
Declaration
ValueTask WaitAsync(CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | token | The token that can be used to cancel waiting operation. |
Returns
Type | Description |
---|---|
ValueTask | The task representing asynchronous result. |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The current instance has already been disposed. |
OperationCanceledException | The operation has been canceled. |
WaitAsync(TimeSpan, CancellationToken)
Suspends the caller until this event is set.
Declaration
ValueTask<bool> WaitAsync(TimeSpan timeout, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | The number of time to wait before this event is set. |
CancellationToken | token | The token that can be used to cancel waiting operation. |
Returns
Type | Description |
---|---|
ValueTask<bool> |
Exceptions
Type | Condition |
---|---|
ObjectDisposedException | The current instance has already been disposed. |
ArgumentOutOfRangeException |
|
OperationCanceledException | The operation has been canceled. |