C# Класс AsyncDolls.AsyncCountdownEvent

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

AddCount() публичный Метод

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
Результат void

AddCount() публичный Метод

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.
Результат void

AsyncCountdownEvent() публичный Метод

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.
Результат System

Signal() публичный Метод

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
Результат void

Signal() публичный Метод

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.
Результат void

TryAddCount() публичный Метод

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
Результат bool

TryAddCount() публичный Метод

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.
Результат bool

TrySignal() публичный Метод

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
Результат bool

TrySignal() публичный Метод

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.
Результат bool

Wait() публичный Метод

Synchronously waits for this event to be set. This method may block the calling thread.
public Wait ( ) : void
Результат void

Wait() публичный Метод

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.
Результат void

WaitAsync() публичный Метод

Asynchronously waits for this event to be set.
public WaitAsync ( ) : Task
Результат Task