Skip to content

Commit af235ab

Browse files
committed
Pid: + make
1 parent 8858e6d commit af235ab

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

pid.ml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ let parse_exn s =
2424
if name = "" then Exn.fail "empty name";
2525
{ id; host=String.lowercase host; name=get_name @@ String.lowercase name; stamp; })
2626

27+
let make ~id ~host ~stamp name =
28+
validate_name "name" name;
29+
validate_name "host" host;
30+
{ id; host; stamp; name }
31+
2732
let new_self name stamp =
2833
let id = Unix.getpid () in
2934
let host = String.lowercase @@ Unix.gethostname () in

pid.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ val name : t -> string
2222
(** @return string representation of pid, can be read back by [parse_pid_exn] *)
2323
val to_string : t -> string
2424

25+
val make : id:int -> host:string -> stamp:int -> string -> t
26+
2527
val compare : t -> t -> int
2628
val equal : t -> t -> bool
2729

0 commit comments

Comments
 (0)