Namespace: System.Threading
Semaphore
Limits the number of threads that can access a resource or pool of resources concurrently.
Methods (2)
Semaphore(Int32,Int32)Constructor
Initializes a new instance of the Semaphore class, specifying the initial number of entries and the maximum number of concurrent entries.
| Parameter | Description |
|---|---|
| initialCount | The initial number of requests for the semaphore that can be granted concurrently. |
| maximumCount | The maximum number of requests for the semaphore that can be granted concurrently. |
int Release(Int32)
Exits the semaphore a specified number of times and returns the previous count.
| Parameter | Description |
|---|---|
| releaseCount | The number of times to exit the semaphore. |
Returns: The count on the semaphore before the Release method was called.