module Clock:Clocks indicate at which rate a source can be read, thus avoiding by typing the need for infinite buffering.sig
..end
class clock :string ->
Source.clock
class wallclock :?sync:bool -> string ->
clock
class self_sync :string ->
object
..end
val running : unit -> bool
Taking all freshly created sources, assigning them to the default
clock if needed, and starting them, is performed by collect
.
This is typically called after each script execution.
Technically we could separate collection and clock assignment,
which might simplify some things if it becomes unmanageable in the
future.
Sometimes we need to be sure that collect doesn't happen during
the execution of a function. Otherwise, sources might be assigned
the default clock too early. This is done using collect_after
.
This need is not cause by running collect in too many places, but
simply because there is no way to control collection on a per-thread
basis (collect only the sources created by a given thread of
script execution).
Functions running using collect_after
should be kept short.
However, in theory, with multiple threads, we could have plenty
of short functions always overlapping so that collection can
never be done. This shouldn't happen too much, but in any case
we can't get rid of this without a more fine-grained collect,
which would require (heavy) execution contexts to tell from
which thread/code a given source has been added.
val collect_after : (unit -> 'a) -> 'a
val force_init : (Source.active_source -> bool) -> Source.active_source list
val start : unit -> unit
val stop : unit -> unit
val fold : (Source.clock -> 'a -> 'a) -> 'a -> 'a
typeclock_variable =
Source.clock_variable
val to_string : clock_variable -> string
val create_unknown : sources:Source.active_source list ->
sub_clocks:clock_variable list -> clock_variable
val create_known : clock -> clock_variable
val unify : clock_variable -> clock_variable -> unit
val get : clock_variable -> Source.clock