package riot

  1. Overview
  2. Docs
type t

t is the type of all processes in the Riot runtime.

A process is a lightweight unit of work that has a lifecycle and a mailbox.

You rarely work directly with this type, and usually handle Pid.t values instead.

val pp : Format.formatter -> t -> unit
type priority =
  1. | High
  2. | Normal
  3. | Low

The priority for a process.

A processes' priority can be adjusted to guarantee it always runs before other processes, or to indicate that it is less important that a process executes timely as long as it executes at some point in the future.

* High priority processes are scheduled and executed before everything else. Use this with care or your other priorities may have to wait a long time before they run.

* Normal priority processes are executed when there are no priority processes ready to be executed.

* Low priority processes are only executed when there are no High and no Normal priority processes left.

type process_flag =
  1. | Trap_exit of bool
    (*

    Trap_exit true makes sure this process does not exit when it receives an Exit message (see Process.Messages) from a linked process that has died.

    *)
  2. | Priority of priority
    (*

    Processes with a High priority will be scheduled before processes with a Normal priority which will be scheduled before processes with a Low priority.

    *)

A process flag is a configuration for the behavior of a process.

type exit_reason =
  1. | Normal
    (*

    The process ended normally.

    *)
  2. | Exit_signal
    (*

    The process received an exit signal

    *)
  3. | Exception of exn
    (*

    The process terminated due to an unhandled exception

    *)
module Messages : sig ... end
val where_is : string -> Pid.t option

where_is name returns the Pid.t that is registered to name or None if no process was registered for that name.

val sid : t -> Core.Scheduler_uid.t

sid t returns the scheduler id for the scheduler in charge of the process.

val await_name : string -> Pid.t

await_name name waits until name is registered to a pid.

NOTE: this function will block the process indefinitely.

val monitor : Pid.t -> unit

monitor pid makes self () a monitor of pid.

When pid terminates, self () will receive a Processes.Messages.Monitor(Process_down(pid)) message.

val demonitor : Pid.t -> unit
val flag : process_flag -> unit
val is_alive : Pid.t -> bool
OCaml

Innovation. Community. Security.