Dispatch provides an efficient implementation of a traditional counting semaphore, which can be used to control access to a resource across multiple execution contexts.
- iOS 7.0+
- macOS 10.9+
- tvOS 9.0+
- watchOS 2.0+
- Xcode 8.0+
You increment a semaphore count by calling the
signal() method, and decrement a semaphore count by calling the wait() method or one of its variants that specifies a timeout.