cpp/thread/counting semaphore

@1@ A is a lightweight synchronization primitive that can control access to a shared resource. Unlike a std, a allows more than one concurrent access to the same resource, for at least  concurrent accessors. The program is ill-formed if is negative.

@2@ is an alias for specialization of  with  being. Implementations may implement more efficiently than the default implementation of.

A contains an internal counter initialized by the constructor. This counter is decremented by calls to acquire and related methods, and is incremented by calls to release. When the counter is zero, acquire blocks until the counter is incremented, but try_acquire does not block; try_acquire_for and try_acquire_until block until the counter is incremented or a timeout is reached.

Similar to std, 's try_acquire can spuriously fail.

Specializations of are not, , , , or.