make ~fair:f p returns a new semaphore with p permits, f
indicating whether a fair ordering policy is requested
(defaulting to false); see
Semaphore(...).
p can be negative, meaning that permits should be released before
any acquisition.acquire s p acquires p permits from semaphore s, blocking until
they are available; see
acquire(...).Java_exception if p is negativeJava_exception if the thread is interruptedacquire_uninterruptibly s p is similar to acquire s p, except
that waiting thread cannot be interrupted; see
acquireUninterruptibly(...).Java_exception if p is negativerelease s p releases p permits from semaphore s; see
release(...).Java_exception if p is negativetry_acquire s p is similar to acquire s p, except the function
always returns immediately returning true if acquisition was
successful; see
tryAcquire(...).Java_exception if p is negativetry_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); see
tryAcquire(...).Java_exception if p is negativeJava_exception if the thread is interruptedwrap obj wraps the reference obj into an option type:Some x if obj is not null;None if obj is null.unwrap obj unwraps the option obj into a bare reference:Some x is mapped to x;None is mapped to null.