Class AsyncCountdownEvent
Represents a synchronization primitive that is signaled when its count reaches zero.
Inherited Members
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 SourceAsyncCountdownEvent(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 SourceCurrentCount
Gets the number of remaining signals required to set the event.
Declaration
public long CurrentCount { get; }
Property Value
Type | Description |
---|---|
Int64 |
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 SourceAddCount()
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. |
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 |
|
InvalidOperationException | The current instance is already set. |
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. |
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 |
|
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. |
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 |
|
InvalidOperationException | The current instance is already set; or |
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. |
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 |
|