Xapi_stdext_threads.Semaphore
val create : int -> t
create n
create a semaphore with initial value n
(a positive integer). Raise Invalid_argument
if n
<= 0
val acquire : t -> int -> unit
acquire k s
block until the semaphore value is >= k
(a positive integer), then atomically decrement the semaphore value by k
. Raise Invalid_argument
if k
<= 0
val release : t -> int -> unit
release k s
atomically increment the semaphore value by k
(a positive integer). Raise Invalid_argument
if k
<= 0
val execute_with_weight : t -> int -> (unit -> 'a) -> 'a
val execute : t -> (unit -> 'a) -> 'a
execute s f
same as {execute_with_weight} s 1 f