module Phaser:sig
..end
type
t
Phasers are also organized in a tree-like structure, to reduce contention: a phaser is automatically registered/deregistered with its parent when the number of parties becomes respectively non-zero/zero.
The phase number of a phaser starts at zero, and advances when all
parties arrive at the phaser.
val make : t option -> int32 -> t
make p n
returns a new phaser with parent p
, and number of
parties n
.
Raises Invalid_argument
if n
is negative.
val arrive : t -> int32
Raises Invalid_argument
if the phase number would be negative while
the phaser is not terminated.
val arrive_and_await_advance : t -> int32
Raises Invalid_argument
if the phase number would be negative while
the phaser is not terminated.
val arrive_and_deregister : t -> int32
Raises Invalid_argument
if the phase number would be negative while
the phaser is not terminated.
val await_advance : t -> int32 -> int32
val await_advance_interruptibly : t -> int32 -> int32
await_advance
except that the thread can be interrupted.
Raises Runtime.Interrupted
if the thread is interrupted.
val await_advance_interruptibly_time : t -> int32 -> int64 -> TimeUnit.t -> int32
await_advance_interruptibly_time p pn t u
is similar to
await_advance_interruptibly p pn
, except that the current
thread will at most wait for t
(time value whose unit is u
).
Raises Runtime.Interrupted
if the thread is interrupted.
Raises Runtime.Timeout
if time has elapsed without reaching the
given phase number.
val bulk_register : t -> int32 -> int32
bulk_register p n
adds n
unarrived parties to phaser p
.
Raises Invalid_argument
if n
is negative.
Raises Invalid_argument
if the maximum number of parties has
already been reached.
val force_termination : t -> unit
val get_arrived_parties : t -> int32
val get_parent : t -> t option
val get_phase : t -> int32
val get_registered_parties : t -> int32
val get_root : t -> t
val get_unarrived_parties : t -> int32
val is_terminated : t -> bool
val register : t -> int32
Raises Invalid_argument
if the maximum number of parties has
already been reached.