C# Class Polly.Utilities.AsyncSemaphoreExtensions

Contains extension methods for Nito.AsyncEx.AsyncSemaphore
Mostra file Open project: App-vNext/Polly

Public Methods

Method Description
Dispose ( this asyncSemaphore ) : void

Disposes of managed resources.

Wait ( this asyncSemaphore, System.TimeSpan timeSpan, CancellationToken cancellationToken ) : bool

Synchronously waits for a slot in the semaphore to be available. This method may block the calling thread.

WaitAsync ( this asyncSemaphore, System.TimeSpan timeSpan, CancellationToken cancellationToken ) : Task

Asynchronously waits for a slot in the semaphore to be available. This method may block the calling thread.

Method Details

Dispose() public static method

Disposes of managed resources.
public static Dispose ( this asyncSemaphore ) : void
asyncSemaphore this The instance.
return void

Wait() public static method

Synchronously waits for a slot in the semaphore to be available. This method may block the calling thread.
public static Wait ( this asyncSemaphore, System.TimeSpan timeSpan, CancellationToken cancellationToken ) : bool
asyncSemaphore this The instance.
timeSpan System.TimeSpan A TimeSpan for which to wait. In this implementation, only TimeSpan.Zero is permitted, indicating that an attempt should be made to obtain the semaphore immediately, without further waiting. The implementation is intentionally limited to only what is needed to support Polly's use of the corresponding overload in System.Threading.Tasks.SemaphoreSlim version later than .NET 4.0..
cancellationToken System.Threading.CancellationToken The cancellation token used to cancel the wait. If this is already set, then this method will attempt to take the slot immediately (succeeding if a slot is currently available).
return bool

WaitAsync() public static method

Asynchronously waits for a slot in the semaphore to be available. This method may block the calling thread.
public static WaitAsync ( this asyncSemaphore, System.TimeSpan timeSpan, CancellationToken cancellationToken ) : Task
asyncSemaphore this The instance.
timeSpan System.TimeSpan A TimeSpan for which to wait. In this implementation, only TimeSpan.Zero is permitted, indicating that an attempt should be made to obtain the semaphore immediately, without further waiting. The implementation is intentionally limited to only what is needed to support Polly's use of the corresponding overload in System.Threading.Tasks.SemaphoreSlim version later than .NET 4.0..
cancellationToken System.Threading.CancellationToken The cancellation token used to cancel the wait. If this is already set, then this method will attempt to take the slot immediately (succeeding if a slot is currently available).
return Task