Show / Hide Table of Contents

Class AsyncCountdownEvent

Represents a synchronization primitive that is signaled when its count reaches zero.

Inheritance
Object
Synchronizer
AsyncCountdownEvent
Implements
IAsyncEvent
ISynchronizer
IDisposable
Inherited Members
Synchronizer.ISynchronizer.HasWaiters
Synchronizer.IsSet
Synchronizer.WaitAsync(TimeSpan, CancellationToken)
Synchronizer.WaitAsync<T>(Predicate<T>, T, TimeSpan, CancellationToken)
Synchronizer.WaitAsync<T>(Predicate<T>, T, CancellationToken)
Synchronizer.WaitAsync<T1, T2>(Func<T1, T2, Boolean>, T1, T2, TimeSpan, CancellationToken)
Synchronizer.WaitAsync<T1, T2>(Func<T1, T2, Boolean>, T1, T2, CancellationToken)
Synchronizer.Dispose(Boolean)
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public class AsyncCountdownEvent : Synchronizer, IAsyncEvent, ISynchronizer, IDisposable
Remarks

This is asynchronous version of CountdownEvent.

Constructors

| Improve this Doc View Source

AsyncCountdownEvent(Int64)

Creates a new countdown event with the specified count.

Declaration
public AsyncCountdownEvent(long initialCount)
Parameters
Type Name Description
Int64 initialCount

The number of signals initially required to set the event.

Properties

| Improve this Doc View Source

CurrentCount

Gets the number of remaining signals required to set the event.

Declaration
public long CurrentCount { get; }
Property Value
Type Description
Int64
| Improve this Doc View Source

InitialCount

Gets the numbers of signals initially required to set the event.

Declaration
public long InitialCount { get; }
Property Value
Type Description
Int64

Methods

| Improve this Doc View Source

AddCount()

Increments the current count by one.

Declaration
public void AddCount()
Exceptions
Type Condition
ObjectDisposedException

The current instance has already been disposed.

InvalidOperationException

The current instance is already set.

| Improve this Doc View Source

AddCount(Int64)

Increments the current count by a specified value.

Declaration
public void AddCount(long signalCount)
Parameters
Type Name Description
Int64 signalCount

The value by which to increase CurrentCount.

Exceptions
Type Condition
ObjectDisposedException

The current instance has already been disposed.

ArgumentOutOfRangeException

signalCount is less than zero.

InvalidOperationException

The current instance is already set.

| Improve this Doc View Source

Reset()

Resets the CurrentCount to the value of InitialCount.

Declaration
public bool Reset()
Returns
Type Description
Boolean

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.

| Improve this Doc View Source

Reset(Int64)

Resets the InitialCount property to a specified value.

Declaration
public bool Reset(long count)
Parameters
Type Name Description
Int64 count

The number of signals required to set this event.

Returns
Type Description
Boolean

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.

ArgumentOutOfRangeException

count is less than zero.

| Improve this Doc View Source

Signal()

Registers multiple signals with this object, decrementing the value of CurrentCount by one.

Declaration
public bool Signal()
Returns
Type Description
Boolean

true if the signals caused the count to reach zero and the event was set; otherwise, false.

Exceptions
Type Condition
ObjectDisposedException

The current instance has already been disposed.

InvalidOperationException

The current instance is already set.

| Improve this Doc View Source

Signal(Int64)

Registers multiple signals with this object, decrementing the value of CurrentCount by the specified amount.

Declaration
public bool Signal(long signalCount)
Parameters
Type Name Description
Int64 signalCount

The number of signals to register.

Returns
Type Description
Boolean

true if the signals caused the count to reach zero and the event was set; otherwise, false.

Exceptions
Type Condition
ObjectDisposedException

The current instance has already been disposed.

ArgumentOutOfRangeException

signalCount is less than 1.

InvalidOperationException

The current instance is already set; or signalCount is greater than CurrentCount.

| Improve this Doc View Source

TryAddCount()

Attempts to increment the current count by one.

Declaration
public bool TryAddCount()
Returns
Type Description
Boolean

true if the increment succeeded; if CurrentCount is already at zero this will return false.

Exceptions
Type Condition
ObjectDisposedException

The current instance has already been disposed.

| Improve this Doc View Source

TryAddCount(Int64)

Attempts to increment the current count by a specified value.

Declaration
public bool TryAddCount(long signalCount)
Parameters
Type Name Description
Int64 signalCount

The value by which to increase CurrentCount.

Returns
Type Description
Boolean

true if the increment succeeded; if CurrentCount is already at zero this will return false.

Exceptions
Type Condition
ObjectDisposedException

The current instance has already been disposed.

ArgumentOutOfRangeException

signalCount is less than zero.

Implements

IAsyncEvent
ISynchronizer
System.IDisposable

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
AsyncEvent.WaitAsync(IAsyncEvent, TimeSpan)
AsyncEvent.WaitAsync(IAsyncEvent, CancellationToken)
AsyncEvent.WaitAsync(IAsyncEvent)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>)
ObjectExtensions.As<T>(T)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
ExpressionBuilder.Const<T>(T)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX