Creates new counting semaphore with an initial value.
- iOS 4.0+
- macOS 10.6+
- UIKit for Mac 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
The starting value for the semaphore. Do not pass a value less than zero.
The newly created semaphore.
Passing zero for the value is useful for when two threads need to reconcile the completion of a particular event. Passing a value greater than zero is useful for managing a finite pool of resources, where the pool size is equal to the value.