Show / Hide Table of Contents

Class AsyncManualResetEvent

Represents asynchronous version of ManualResetEvent.

Inheritance
object
Disposable
QueuedSynchronizer
AsyncManualResetEvent
Implements
IAsyncResetEvent
IAsyncEvent
IDisposable
IResettable
Inherited Members
QueuedSynchronizer.MeasurementTags
QueuedSynchronizer.TrackSuspendedCallers(Func<object>)
QueuedSynchronizer.SetCallerInformation(object)
QueuedSynchronizer.GetSuspendedCallers()
QueuedSynchronizer.CancelSuspendedCallers(CancellationToken)
QueuedSynchronizer.Dispose(bool)
QueuedSynchronizer.Dispose(Exception)
QueuedSynchronizer.DisposeAsyncCore()
QueuedSynchronizer.DisposeAsync()
Disposable.IsDisposed
Disposable.IsDisposing
Disposable.IsDisposingOrDisposed
Disposable.CreateException()
Disposable.DisposedTask
Disposable.GetDisposedTask<T>()
Disposable.TrySetDisposedException<T>(TaskCompletionSource<T>)
Disposable.TrySetDisposedException(TaskCompletionSource)
Disposable.TryBeginDispose()
Disposable.Dispose()
Disposable.Dispose(IEnumerable<IDisposable>)
Disposable.DisposeAsync(IEnumerable<IAsyncDisposable>)
Disposable.Dispose<T>(ReadOnlySpan<T>)
Disposable.DisposeAsync(params IAsyncDisposable[])
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public class AsyncManualResetEvent : QueuedSynchronizer, IAsyncResetEvent, IAsyncEvent, IDisposable, IResettable

Constructors

| Edit this page View Source

AsyncManualResetEvent(bool)

Initializes a new asynchronous reset event in the specified state.

Declaration
public AsyncManualResetEvent(bool initialState)
Parameters
Type Name Description
bool initialState

true to set the initial state signaled; false to set the initial state to non signaled.

| Edit this page View Source

AsyncManualResetEvent(bool, int)

Initializes a new asynchronous reset event in the specified state.

Declaration
public AsyncManualResetEvent(bool initialState, int concurrencyLevel)
Parameters
Type Name Description
bool initialState

true to set the initial state signaled; false to set the initial state to non signaled.

int concurrencyLevel

The potential number of suspended callers.

Exceptions
Type Condition
ArgumentOutOfRangeException

concurrencyLevel is less than or equal to zero.

Properties

| Edit this page View Source

IsSet

Indicates whether this event is set.

Declaration
public bool IsSet { get; }
Property Value
Type Description
bool

Methods

| Edit this page View Source

Reset()

Sets the state of this event to non signaled, causing consumers to wait asynchronously.

Declaration
public bool Reset()
Returns
Type Description
bool

true if the operation succeeds; otherwise, false.

Exceptions
Type Condition
ObjectDisposedException

The current instance has already been disposed.

| Edit this page View Source

Set()

Sets the state of the event to signaled, allowing one or more awaiters to proceed.

Declaration
public bool Set()
Returns
Type Description
bool

true if the operation succeeds; otherwise, false.

Exceptions
Type Condition
ObjectDisposedException

The current instance has already been disposed.

| Edit this page View Source

Set(bool)

Sets the state of the event to signaled, allowing one or more awaiters to proceed; and, optionally, reverts the state of the event to initial state.

Declaration
public bool Set(bool autoReset)
Parameters
Type Name Description
bool autoReset

true to reset this object to non-signaled state automatically; false to leave this object in signaled state.

Returns
Type Description
bool

true if the operation succeeds; otherwise, false.

Exceptions
Type Condition
ObjectDisposedException

The current instance has already been disposed.

| Edit this page View Source

WaitAsync(CancellationToken)

Turns caller into idle state until the current event is set.

Declaration
public ValueTask WaitAsync(CancellationToken token = default)
Parameters
Type Name Description
CancellationToken token

The token that can be used to abort wait process.

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.

| Edit this page View Source

WaitAsync(TimeSpan, CancellationToken)

Turns caller into idle state until the current event is set.

Declaration
public ValueTask<bool> WaitAsync(TimeSpan timeout, CancellationToken token = default)
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
ValueTask<bool>

true if signaled state was set; otherwise, false.

Exceptions
Type Condition
ObjectDisposedException

The current instance has already been disposed.

ArgumentOutOfRangeException

timeout is negative.

OperationCanceledException

The operation has been canceled.

Implements

IAsyncResetEvent
IAsyncEvent
IDisposable
IResettable

Extension Methods

BasicExtensions.As<T>(T)
BasicExtensions.GetUserData<T>(T)
BasicExtensions.IsBetween<T, TLowerBound, TUpperBound>(T, TLowerBound, TUpperBound)
BasicExtensions.IsOneOf<T>(T, ReadOnlySpan<T>)
ExpressionBuilder.Const<T>(T)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, bool, TimeSpan, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan, CancellationToken)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
  • Edit this page
  • View Source
☀
☾
In this article
Back to top
Supported by the .NET Foundation
☀
☾