Class AsyncAutoResetEvent
Represents asynchronous version of
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public class AsyncAutoResetEvent : QueuedSynchronizer, IAsyncResetEvent, IAsyncEvent, ISynchronizer, IDisposable
Constructors
| Improve this Doc View SourceAsyncAutoResetEvent(Boolean)
Initializes a new asynchronous reset event in the specified state.
Declaration
public AsyncAutoResetEvent(bool initialState)
Parameters
Type | Name | Description |
---|---|---|
Boolean | initialState | true to set the initial state signaled; false to set the initial state to non signaled. |
Properties
| Improve this Doc View SourceIsSet
Gets whether this event is set.
Declaration
public bool IsSet { get; }
Property Value
Type | Description |
---|---|
Boolean |
Methods
| Improve this Doc View SourceReset()
Sets the state of this event to non signaled, causing consumers to wait asynchronously.
Declaration
public bool Reset()
Returns
Type | Description |
---|---|
Boolean | true if the operation succeeds; otherwise, false. |
Set()
Sets the state of the event to signaled, allowing one or more awaiters to proceed.
Declaration
public bool Set()
Returns
Type | Description |
---|---|
Boolean | true if the operation succeeds; otherwise, false. |
Wait(TimeSpan, CancellationToken)
Turns caller into idle state until the current event is set.
Declaration
public Task<bool> Wait(TimeSpan timeout, CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | timeout | The interval to wait for the signaled state. |
CancellationToken | token | The token that can be used to abort wait process. |
Returns
Type | Description |
---|---|
Task<Boolean> | true if signaled state was set; otherwise, false. |
Explicit Interface Implementations
| Improve this Doc View SourceIAsyncEvent.Signal()
Declaration
bool IAsyncEvent.Signal()
Returns
Type | Description |
---|---|
Boolean |
IAsyncResetEvent.ResetMode
Declaration
EventResetMode IAsyncResetEvent.ResetMode { get; }
Returns
Type | Description |
---|---|
EventResetMode |
Implements
IDisposable