SemaphoreSlim Constructor (Int32, Int32)

Task Parallel System.Threading

Initializes a new instance of the SemaphoreSlim class, specifying the initial and maximum number of requests that can be granted concurrently.

Namespace:  System.Threading
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Sub New ( _
	initialCount As Integer, _
	maxCount As Integer _
)
C#
public SemaphoreSlim(
	int initialCount,
	int maxCount
)

Parameters

initialCount
Type: System..::.Int32
The initial number of requests for the semaphore that can be granted concurrently.
maxCount
Type: System..::.Int32
The maximum number of requests for the semaphore that can be granted concurrently.

Exceptions

ExceptionCondition
System..::.ArgumentOutOfRangeException initialCount is less than 0. -or- initialCount is greater than maxCount. -or- maxCount is less than 0.

See Also