Idris2Doc : IO.Async.Semaphore

IO.Async.Semaphore

(source)

Definitions

recordSemaphore : 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 : IORefST->Semaphore

Projection: 
.ref : Semaphore->IORefST
semaphore : Lift1Worldf=>Nat->fSemaphore
  Creates a new semaphore with an internal counter of `n`.

Totality: total
Visibility: export
releaseN : HasIOio=>Semaphore->Nat->io ()
  Atomically reduces the internal counter of the semaphore by the
given number.

Totality: total
Visibility: export
release : HasIOio=>Semaphore->io ()
  Atomically reduces the internal counter of the semaphore by one.

Totality: total
Visibility: export
acquireN : Semaphore->Nat->Asyncees ()
  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: export
acquire : Semaphore->Asyncees ()
  Alias for `acquireN 1`

Totality: total
Visibility: export