C# Class AsyncDolls.AsyncCountdownEvent

Mostrar archivo Open project: danielmarbach/async-dolls Class Usage Examples

Public Methods

Method Description
AddCount ( ) : void

Attempts to add one to the current count. This method throws InvalidOperationException if the count is already at zero or if the new count would be greater than Int32.MaxValue.

AddCount ( int signalCount ) : void

Attempts to add the specified value to the current count. This method throws InvalidOperationException if the count is already at zero or if the new count would be greater than Int32.MaxValue.

AsyncCountdownEvent ( int count ) : System

Creates an async-compatible countdown event.

Signal ( ) : void

Attempts to subtract one from the current count. This method throws InvalidOperationException if the count is already at zero or if the new count would be less than zero.

Signal ( int signalCount ) : void

Attempts to subtract the specified value from the current count. This method throws InvalidOperationException if the count is already at zero or if the new count would be less than zero.

TryAddCount ( ) : bool

Attempts to add one to the current count. This method returns false if the count is already at zero or if the new count would be greater than Int32.MaxValue.

TryAddCount ( int signalCount ) : bool

Attempts to add the specified value to the current count. This method returns false if the count is already at zero or if the new count would be greater than Int32.MaxValue.

TrySignal ( ) : bool

Attempts to subtract one from the current count. This method returns false if the count is already at zero or if the new count would be less than zero.

TrySignal ( int signalCount ) : bool

Attempts to subtract the specified value from the current count. This method returns false if the count is already at zero or if the new count would be less than zero.

Wait ( ) : void

Synchronously waits for this event to be set. This method may block the calling thread.

Wait ( CancellationToken cancellationToken ) : void

Synchronously waits for this event to be set. This method may block the calling thread.

WaitAsync ( ) : Task

Asynchronously waits for this event to be set.

Private Methods

Method Description
ModifyCount ( int signalCount ) : bool

Attempts to modify the current count by the specified amount. This method returns false if the new current count value would be invalid, or if the count has already reached zero.

Method Details

AddCount() public method

Attempts to add one to the current count. This method throws InvalidOperationException if the count is already at zero or if the new count would be greater than Int32.MaxValue.
public AddCount ( ) : void
return void

AddCount() public method

Attempts to add the specified value to the current count. This method throws InvalidOperationException if the count is already at zero or if the new count would be greater than Int32.MaxValue.
public AddCount ( int signalCount ) : void
signalCount int The amount to change the current count. This must be greater than zero.
return void

AsyncCountdownEvent() public method

Creates an async-compatible countdown event.
public AsyncCountdownEvent ( int count ) : System
count int The number of signals this event will need before it becomes set. Must be greater than zero.
return System

Signal() public method

Attempts to subtract one from the current count. This method throws InvalidOperationException if the count is already at zero or if the new count would be less than zero.
public Signal ( ) : void
return void

Signal() public method

Attempts to subtract the specified value from the current count. This method throws InvalidOperationException if the count is already at zero or if the new count would be less than zero.
public Signal ( int signalCount ) : void
signalCount int The amount to change the current count. This must be greater than zero.
return void

TryAddCount() public method

Attempts to add one to the current count. This method returns false if the count is already at zero or if the new count would be greater than Int32.MaxValue.
public TryAddCount ( ) : bool
return bool

TryAddCount() public method

Attempts to add the specified value to the current count. This method returns false if the count is already at zero or if the new count would be greater than Int32.MaxValue.
public TryAddCount ( int signalCount ) : bool
signalCount int The amount to change the current count. This must be greater than zero.
return bool

TrySignal() public method

Attempts to subtract one from the current count. This method returns false if the count is already at zero or if the new count would be less than zero.
public TrySignal ( ) : bool
return bool

TrySignal() public method

Attempts to subtract the specified value from the current count. This method returns false if the count is already at zero or if the new count would be less than zero.
public TrySignal ( int signalCount ) : bool
signalCount int The amount to change the current count. This must be greater than zero.
return bool

Wait() public method

Synchronously waits for this event to be set. This method may block the calling thread.
public Wait ( ) : void
return void

Wait() public method

Synchronously waits for this event to be set. This method may block the calling thread.
public Wait ( CancellationToken cancellationToken ) : void
cancellationToken System.Threading.CancellationToken The cancellation token used to cancel the wait. If this token is already canceled, this method will first check whether the event is set.
return void

WaitAsync() public method

Asynchronously waits for this event to be set.
public WaitAsync ( ) : Task
return Task