DispatchSemaphore
An object that controls access to a resource across multiple execution contexts through use of a traditional counting semaphore.
Declaration
class DispatchSemaphoreOverview
A dispatch semaphore is an efficient implementation of a traditional counting semaphore. Dispatch semaphores call down to the kernel only when the calling thread needs to be blocked. If the calling semaphore does not need to block, no kernel call is made.
You increment a semaphore count by calling the signal() method, and decrement a semaphore count by calling wait() or one of its variants that specifies a timeout.