module Semaphore:sig..end
type t
val make : int32 -> bool -> tmake p f returns a new semaphore with p permits, f indicating
whether a fair ordering policy is requested.
p can be negative, meaning that permits should be released before
any acquisition.
val acquire : t -> int32 -> unitacquire s p acquires p permits from semaphore s, blocking until
they are available.
Raises Invalid_argument if p is negative.
Raises Runtime.Interrupted if the thread is interrupted.
val acquire_uninterruptibly : t -> int32 -> unitacquire_uninterruptibly s p is similar to acquire s p, except
that waiting thread cannot be interrupted.
Raises Invalid_argument if p is negative.
val available_permits : t -> int32val drain_permits : t -> int32val get_queue_length : t -> int32val has_queued_threads : t -> boolval is_fair : t -> boolval release : t -> int32 -> unitrelease s p releases p permits from semaphore s.
Raises Invalid_argument if p is negative.
val try_acquire : t -> int32 -> booltry_acquire s p is similar to acquire s p, except the function
always returns immediately returning true if acquisition was
successful.
Raises Invalid_argument if p is negative.
val try_acquire_time : t -> int32 -> int64 -> TimeUnit.t -> booltry_acquire_time s p t u is similar to try_acquire s p, except
that the current thread will at most wait for t (time value whose
unit is u).
Raises Invalid_argument if p is negative.
Raises Runtime.Interrupted if the thread is interrupted.