package index
Module type Platform.SEMAPHORESource
Binary semaphores for mutual exclusion
val make : bool -> tmake b returns a new semaphore with the given initial state. If b is true, the semaphore is initially available for acquisition; otherwise, the semaphore is initially unavailable.
val acquire : string -> t -> unitAcquire the given semaphore. Acquisition is not re-entrant.
val release : t -> unitRelease the given semaphore. If any threads are attempting to acquire the semaphore, exactly one of them will gain access to the semaphore.
val with_acquire : string -> t -> (unit -> 'a) -> 'awith_acquire t f first obtains t, then computes f (), and finally release t.
val is_held : t -> boolis_held t returns true if the semaphore is held, without acquiring t.