package riot

  1. Overview
  2. Docs

Module RiotSource

Riot

Sourcemodule Ref : sig ... end
Sourcemodule Pid : sig ... end
Sourcemodule Message : sig ... end
Sourcemodule Process : sig ... end
Sourceval random : unit -> Random.State.t

Returnts the current random state from a scheduler.

Sourceval yield : unit -> unit

Suspends execution of the current process and returns control to the scheduler

Sourceval sleep : float -> unit

sleep t Suspends execution of the current process for at least `t` seconds. `t` is a float so it supports subsecond values: `0.001` is 1 millisecond.

Sourceval self : unit -> Pid.t

Returns the process identifier (pid) for the current process

Sourceval process_flag : Process.process_flag -> unit
Sourceval exit : Pid.t -> Process.exit_reason -> unit

Sends an exit signal to the process pid, to exit with reason exit_reason

Sourceval send : Pid.t -> Message.t -> unit

Sends a message to process with this pid.

Sourceval spawn : (unit -> unit) -> Pid.t

Spawns a new process.

Spawns a new process and links it to the current process before returning.

Links the current process and the process pid together.

Sourceval monitor : Pid.t -> Pid.t -> unit

Makes pid1 a monitor of pid2. When pid2 terminates, pid1 will receive a message.

Sourceval processes : unit -> (Pid.t * Process.t) Seq.t
Sourceval is_process_alive : Pid.t -> bool

Returns true if the process pid is still alive.

Sourceval wait_pids : Pid.t list -> unit

Await all processes in the list to termimante.

Sourceval receive : ?ref:unit Ref.t -> unit -> Message.t

receive () will return the first message in the process mailbox.

This function will suspend a process that has an empty mailbox, and the process will remain asleep until a message is delivered to it.

### Selective Receive

If a `ref` was passed, then `receive ref ()` will skip all messages created before the creation of this `Ref.t` value, and will only return newer messages.

This is useful to skip the queue, but not remove any of the messages before it. Those messages will be delivered in-order in future calls to `receive ()`.

Sourceval shutdown : unit -> unit

Gracefully shuts down the runtime. Any non-yielding process will block this.

Sourceval run : ?rnd:Random.State.t -> ?workers:int -> (unit -> unit) -> unit

Start the Riot runtime using function main to boot the system

Sourceval trace_send : (Pid.t -> Process.t -> Message.t -> unit) -> unit
Sourceval trace_proc_run : (int -> Process.t -> unit) -> unit
Sourcemodule Gen_server : sig ... end
Sourcemodule Supervisor : sig ... end
Sourcetype ('a, 'b) logger_format = (('a, Format.formatter, unit, 'b) format4 -> 'a) -> 'b
Sourcemodule type Logger = sig ... end
Sourcemodule Logger : sig ... end
Sourcemodule Net : sig ... end
Sourcemodule Timer : sig ... end
Sourcemodule Queue : sig ... end
OCaml

Innovation. Community. Security.