Affect.SemaphoreSemaphores.
A semaphore with capacity n throttles access to a ressource with limited n.
val make : int -> tmake n is a semaphore with a capacity of n.
val acquire : t -> unitacquire s blocks until s can be decremented to a non-negative integer.
val release : t -> unitrelease s increments the value of s. If there are multiple blocked acquire on s, only the earliest acquire unblocks.
val with_acquired : t -> (unit -> 'a) -> 'awith_acquired s f acquires s executes f () and releases s when f returns a value or an exception.
val get_value : t -> intget_value s is the current value of semaphore s.
val capacity : t -> intcapacity s is the capacity of s.