The value parameter is the initial value for the counting semaphore.
dispatch_semaphore_wait() decreases the semaphore counter and waits if the resulting value is less than 0 (i.e. you can call dispatch_semaphore_wait four times without waiting for the semaphore created with value 4).
dispatch_semaphore_signal() increments the semaphore count and wakes the waiter if the resulting value is less than or equal to 0.
See the dispatch_semaphore_create(3) man page for a typical use case (managing a finite resource pool).
source share