33
Concurrency support library
[thread]
33.8
Semaphore
[thread.sema]
33.8.1
General
[thread.sema.general]
1
#
Semaphores are lightweight synchronization primitives used to constrain concurrent access to a shared resource
.
They are widely used to implement other synchronization primitives and, whenever both are applicable, can be more efficient than condition variables
.
2
#
A counting semaphore is a semaphore object that models a non-negative resource count
.
A binary semaphore is a semaphore object that has only two states
.
A binary semaphore should be more efficient than the default implementation of a counting semaphore with a unit resource count
.