QSem
is a quantity semaphore in which the resource is acquired
and released in units of one. It provides guaranteed FIFO ordering
for satisfying blocked waitQSem
calls.
The pattern
bracket_ waitQSem signalQSem (...)
is safe; it never loses a unit of the resource.