Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

SemaphoreSlim.Release Method

Definition

Namespace:
System.Threading
Assemblies:
mscorlib.dll, System.Threading.dll
Assemblies:
netstandard.dll, System.Threading.dll
Assembly:
System.Threading.dll
Assembly:
mscorlib.dll
Assembly:
netstandard.dll

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Releases the SemaphoreSlim object.

Overloads

Name Description
Release()

Releases the SemaphoreSlim object once.

Release(Int32)

Releases the SemaphoreSlim object a specified number of times.

Release()

Source:
SemaphoreSlim.cs
Source:
SemaphoreSlim.cs
Source:
SemaphoreSlim.cs
Source:
SemaphoreSlim.cs
Source:
SemaphoreSlim.cs

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

The current instance has already been disposed.

The SemaphoreSlim has already reached its maximum size.

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

Applies to

Release(Int32)

Source:
SemaphoreSlim.cs
Source:
SemaphoreSlim.cs
Source:
SemaphoreSlim.cs
Source:
SemaphoreSlim.cs
Source:
SemaphoreSlim.cs

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

The number of times to exit the semaphore.

Returns

The previous count of the SemaphoreSlim.

Exceptions

The current instance has already been disposed.

releaseCount is less than 1.

The SemaphoreSlim has already reached its maximum size.

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


Feedback

Was this page helpful?