Method RentAsync
RentAsync(SemaphoreSlim)
Asynchronously waits to enter the SemaphoreSlim and returns a disposable object that releases the semaphore when disposed.
Declaration
public static Task<IDisposable> RentAsync(this SemaphoreSlim semaphoreSlim)
Parameters
Type | Name | Description |
---|---|---|
SemaphoreSlim | semaphoreSlim | The semaphore to rent. |
Returns
Type | Description |
---|---|
Task<IDisposable> | A task that represents the asynchronous operation. The task result is a disposable object that releases the semaphore when disposed. |