SemaphoreSlim.Release SemaphoreSlim.Release SemaphoreSlim.Release SemaphoreSlim.Release Method

Definition

Releases the SemaphoreSlim object.

Overloads

Release() Release() Release() Release()

Releases the SemaphoreSlim object once.

Release(Int32) Release(Int32) Release(Int32) Release(Int32)

Releases the SemaphoreSlim object a specified number of times.

Release() Release() Release() Release()

Releases the SemaphoreSlim object once.

public:
 int Release();
public int Release ();
member this.Release : unit -> int
Public Function Release () As Integer

Returns

The previous count of the SemaphoreSlim.

Exceptions

Remarks

A call to the Release() method increments the CurrentCount property by one. If the value of the CurrentCount property is zero before this method is called, the method also allows one thread or task blocked by a call to the Wait or WaitAsync method to enter the semaphore.

See also

Release(Int32) Release(Int32) Release(Int32) Release(Int32)

Releases the SemaphoreSlim object a specified number of times.

public:
 int Release(int releaseCount);
public int Release (int releaseCount);
member this.Release : int -> int
Public Function Release (releaseCount As Integer) As Integer

Parameters

releaseCount
Int32 Int32 Int32 Int32

The number of times to exit the semaphore.

Returns

The previous count of the SemaphoreSlim.

Exceptions

Remarks

A call to the Release(Int32) method increments the CurrentCount property by releaseCount. If the value of the CurrentCount property is zero before this method is called, the method also allows releaseCount threads or tasks blocked by a call to the Wait or WaitAsync method to enter the semaphore.

See also

Applies to