package riot
Install
    
    dune-project
 Dependency
Authors
Maintainers
Sources
sha256=f035f5b6ac2558794298bb7f5c7aeb73feea93e32125dc019c0aa6424b13aa8a
    
    
  sha512=854ae5310d49ca863ac4ea6aa7e7f9129d5b0e3d7093ca16c42d3e5a287219745e24249ff5d00173dd0f60754fc85d98f22895f2084ec0b16c7fb35fdb5d9802
    
    
  doc/riot/Riot/index.html
Module RiotSource
Riot
module Timeout : sig ... endmodule Ref : sig ... endmodule Pid : sig ... endmodule Message : sig ... endmodule Process : sig ... endmodule Application : sig ... endA Riot `Application` can be used to encapsulate functionality that must share the same lifecycle. For example, the `Riot.Logger` is an Application.
val random : unit -> Random.State.tReturns the current random state from a scheduler.
Suspends execution of the current process and returns control to the scheduler
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.
val self : unit -> Pid.tReturns the process identifier (pid) for the current process
val process_flag : Process.process_flag -> unitval exit : Pid.t -> Process.exit_reason -> unitSends an exit signal to the process pid, to exit with reason exit_reason
val send_by_name : name:string -> Message.t -> unitSends a message to a process registered with name. If name is not a valid destination for a message, this function raises an Invalid_destination name exception.
val spawn : (unit -> unit) -> Pid.tSpawns a new process.
val spawn_pinned : (unit -> unit) -> Pid.tSpawns a new process using the current scheduler.
val spawn_link : (unit -> unit) -> Pid.tSpawns a new process and links it to the current process before returning.
exception Name_already_registered of string * Pid.tval register : string -> Pid.t -> unitregister name pid registers a process by a given name. The name will be uniquely associated to this process and attempting to register the same name twice will result in an exception Name_already_registered being raised.
unregister name frees a name and allows it to be re-registered. If the name was not registered before, this operation does nothing.
exception Link_no_process of Pid.tval link : Pid.t -> unitLinks the current process and the process pid together.
val monitor : Pid.t -> unitmonitor pid makes self () a monitor of pid.
When pid terminates, self () will receive a Processes.Messages.Monitor(Process_down(pid)) message.
`processes ()` will list all the processes currently alive.
val is_process_alive : Pid.t -> boolReturns true if the process pid is still alive.
val wait_pids : Pid.t list -> unitAwait all processes in the list to termimante.
val receive : 
  selector:(Message.t -> [ `select of 'msg | `skip ]) ->
  ?after:int64 ->
  ?ref:unit Ref.t ->
  unit ->
  'msgreceive () 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.
### Timed Receive
If a `after was passed, then `receive ~after ()` will wait up to after and raise an `Receive_timeout` exception that can be matched on.
This is useful to prevent deadlock of processes when receiving messages.
### Selective Receive
If a `selector` was passed, the `selector` function will be used to select if a message will be picked or if it will be skipped.
### Receive with Refs
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 ()`.
receive_any () behaves like receive but does not require a selector and instead will return any message in the mailbox.
Gracefully shuts down the runtime. Any non-yielding process will block this.
Start the Riot runtime using function main to boot the system
val run_with_status : 
  ?rnd:Random.State.t ->
  ?workers:int ->
  on_error:('error -> int) ->
  (unit -> (int, 'error) result) ->
  unitrun_with_status ~on_error main starts the Riot runtime using function main to boot the system and handling errors with on_error.
main should return a result of either an exit code or an error. on_error should handle an error code appropriately, then return a status code.
val start : 
  ?rnd:Random.State.t ->
  ?workers:int ->
  apps:(module Application.Intf) list ->
  unit ->
  unitStart the Riot runtime with a series of applications.
Each application will be started in the same order as specified, and if any application fails to start up, the system will be shutdown.
Once the applications are started, they will all be monitored until they are all terminated. Only then will the runtime shutdown.
module Gen_server : sig ... endmodule Supervisor : sig ... endmodule Dynamic_supervisor : sig ... endmodule Telemetry : sig ... endmodule Logger : sig ... endmodule Fd : sig ... endmodule IO : sig ... endmodule File : sig ... endmodule Net : sig ... endmodule SSL : sig ... endmodule Timer : sig ... endmodule Bytestring : sig ... endmodule Queue : sig ... endmodule Hashmap : sig ... endRiot's Hashmap is a process-safe implementation of a hash-table.
module Stream : sig ... endmodule Task : sig ... endmodule Store : sig ... endmodule Crypto : sig ... endmodule Runtime : sig ... end