Module Rml_async

module Rml_async: sig .. end

Launching asychronous computations.

To use this module, ReactiveML programs need to be compiled with the option -thread.

val proc_of_fun : ('a -> 'b) -> 'a -> 'b process

run proc_of_fun f x executes f x in a thread. The execution can last several instants and terminates when the computation of f x terminates. If f x do not terminate, the system remains cooperative.

val exec : ('a, 'b) event -> ('c -> 'a) -> 'c -> unit

exec term f x spawns the computation of f x in a thread and terminates instantaneously. When the computation of f x terminates, the result is sent on the signal term.

val safe_emit : ('a, 'b) event -> 'a -> unit

safe_emit s v will emit the value v on the signal s, but there is no guaranty on the instant of emission. This function can be called from an external thread.

val yield : unit -> unit

yield () re-schedules the calling thread without suspending it. This function can be used to give scheduling hints, telling the thread scheduler that now is a good time to switch to other threads.