C# Class AsyncDolls.AsyncCountdownEvent

Afficher le fichier Open project: danielmarbach/async-dolls Class Usage Examples

Méthodes publiques

Méthode 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

Méthode 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 méthode

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
Résultat void

AddCount() public méthode

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.
Résultat void

AsyncCountdownEvent() public méthode

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.
Résultat System

Signal() public méthode

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
Résultat void

Signal() public méthode

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.
Résultat void

TryAddCount() public méthode

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
Résultat bool

TryAddCount() public méthode

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.
Résultat bool

TrySignal() public méthode

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
Résultat bool

TrySignal() public méthode

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.
Résultat bool

Wait() public méthode

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

Wait() public méthode

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.
Résultat void

WaitAsync() public méthode

Asynchronously waits for this event to be set.
public WaitAsync ( ) : Task
Résultat Task