SemaphoreSlim Constructor (Int32)
Initializes a new instance of the SemaphoreSlim class, specifying the initial number of requests that can be granted concurrently.
Assemblies: mscorlib (in mscorlib.dll)
System.Threading (in System.Threading.dll)
The initialCount parameter defines the number of concurrent requests to enter the semaphore that can be granted. However, it doesn’t define the maximum number of requests that can be granted concurrently. A SemaphoreSlim object instantiated by calling this constructor doesn’t throw a SemaphoreFullException exception if a call to the Release method increases the value of the CurrentCount property beyond initialCount. This occurs if there are more calls to Release methods than there are to Wait or WaitAsync methods. To set the maximum number of concurrent requests to enter the semaphore that can be granted, call the SemaphoreSlim(Int32, Int32) constructor.