|Copyright||(c) The University of Glasgow 2012|
|License||BSD-style (see the file libraries/base/LICENSE)|
|Portability||non-portable (requires STM)|
TSem: transactional semaphores.
TSem has no concept of fairness, and there is no guarantee that threads blocked in
waitTSem will be unblocked in the same order; in fact they will all be unblocked at the same time and will fight over the
TSem is not suitable if you expect there to be a high number of threads contending for the resource. However, like other STM abstractions,
TSem is composable.
TSem with an initial counter value.
A positive initial counter value denotes availability of units
waitTSem can acquire.
The initial counter value can be negative which denotes a resource "debt" that requires a respective amount of
signalTSem operations to counter-balance.
TSem (aka P operation).
This operation acquires a unit from the semaphore (i.e. decreases the internal counter) and blocks (via
retry) if no units are available (i.e. if the counter is not positive).
TSem (aka V operation).
This operation adds/releases a unit back to the semaphore (i.e. increments the internal counter).
This operation adds/releases multiple units back to the semaphore (i.e. increments the internal counter).
signalTSem == signalTSemN 1
© The University of Glasgow and others
Licensed under a BSD-style license (see top of the page).