Previous Up Next

Module CountDownLatch

module CountDownLatch: sig .. end
Countdown synchronization.

type t = java'util'concurrent'CountDownLatch java_instance
The type of countdown latches, that are barrier-like synchronization entities.
val make : java_int -> t
make n returns a countdown latch waiting for n threads; see CountDownLatch(...) .
Raises Java_exception if n is negative
val await : t -> unit
Waits until the coutdown reaches zero, without countingdown; see await(...) .
Raises Java_exception if the thread is interrupted
val await_time : t -> java_long -> TimeUnit.t -> bool
await_time c t u is similar to await c, except that the current thread will at most wait for t (time value whose unit is u); see await(...) .
Raises Java_exception if the thread is interrupted
val count_down : t -> unit
Decrements the count, and then waits for the countdown to reach zero; see countDown(...) .
val get_count : t -> java_long
Returns the current count; see getCount(...) .

Null value

val null : t
The null value.
val is_null : t -> bool
is_null obj returns true iff obj is equal to null.
val is_not_null : t -> bool
is_not_null obj returns false iff obj is equal to null.

Miscellaneous

val wrap : t -> t option
wrap obj wraps the reference obj into an option type:
  • Some x if obj is not null;
  • None if obj is null.

val unwrap : t option -> t
unwrap obj unwraps the option obj into a bare reference:
  • Some x is mapped to x;
  • None is mapped to null.

AltStyle によって変換されたページ (->オリジナル) /