Table of Contents

Class AutoResetEventAsync

Namespace
MarymoorStudios.Core.Promises
Assembly
MarymoorStudios.Core.Promises.dll

An eventual auto-reset event.

public sealed class AutoResetEventAsync
Inheritance
AutoResetEventAsync
Inherited Members

Constructors

AutoResetEventAsync(bool)

Initializes a new AutoResetEventAsync.

public AutoResetEventAsync(bool initialState = false)

Parameters

initialState bool

true if the event is initially signaled.

Properties

IsSignaled

True if the event is in the signaled state.

public bool IsSignaled { get; }

Property Value

bool

Methods

Signal(Exception?)

Signals the event.

public void Signal(Exception? error = null)

Parameters

error Exception

An optional error to signal with.

Remarks

If there are any waiters they are resolved and the event remains in the unsignaled (i.e. the event is pulsed). If there are no waiters then the event is placed in a signaled state. The next waiter to arrive will be resolved immediately and the event will auto-reset at that time.

WaitAsync()

Waits until the event is in a signaled state.

public Promise WaitAsync()

Returns

Promise

Resolves when the event is signaled.

Remarks

Resolves immediately if the event is already in a signaled state. The signaled state is then auto-reset to unsignaled.