Skip to content

Commit

Permalink
feat: add registry to Process module
Browse files Browse the repository at this point in the history
  • Loading branch information
leostera committed Oct 20, 2024
1 parent 0c728e3 commit a3aaa78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/riot-stdlib/process.ml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,5 @@ let demonitor pid =
demonitor pid

let is_alive pid = is_process_alive pid

let register ~name pid = register name pid
11 changes: 7 additions & 4 deletions packages/riot/riot.mli
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ module Process : sig
we will receive the monitoring message.
*)

val register : name:string -> Pid.t -> unit
(** [register ~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. *)

val flag : process_flag -> unit
val is_alive : Pid.t -> bool
end
Expand Down Expand Up @@ -228,10 +234,7 @@ val spawn_link : (unit -> unit) -> Pid.t
exception Name_already_registered of string * Pid.t

val register : string -> Pid.t -> unit
(** [register 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. *)
(** [register name pid] is an alias to [Process.register ~name pid] *)

val unregister : string -> unit
(** [unregister name] frees a name and allows it to be re-registered. If the
Expand Down

0 comments on commit a3aaa78

Please sign in to comment.