record Semaphore : Type A semphore is a synchronization primitive that can
be observed by at most one observer.
It consists of an internal counter that is atomically
reduced every time `release` is invoked.
Calling `await` blocks the calling fiber until the
semaphore's counter has been reduced to 0.
Totality: total
Visibility: export
Constructor: S : IORef ST -> Semaphore
Projection: .ref : Semaphore -> IORef ST
semaphore : Lift1 World f => Nat -> f Semaphore Creates a new semaphore with an internal counter of `n`.
Totality: total
Visibility: exportreleaseN : HasIO io => Semaphore -> Nat -> io () Atomically reduces the internal counter of the semaphore by the
given number.
Totality: total
Visibility: exportrelease : HasIO io => Semaphore -> io () Atomically reduces the internal counter of the semaphore by one.
Totality: total
Visibility: exportacquireN : Semaphore -> Nat -> Async e es () Waits (possibly by semantically blocking the fiber)
until the given number of steps have been released.
Note: Currently, `Semaphore` values can only be observed
by one observer. The calling fiber will block until
canceled, if another fiber has called `await` already.
Totality: total
Visibility: exportacquire : Semaphore -> Async e es () Alias for `acquireN 1`
Totality: total
Visibility: export