Skip to content

Commit

Permalink
fixup! CP-32622: Use Unix.sleepf for sleeps instead of select
Browse files Browse the repository at this point in the history
Use Unix.sleepf instead of Thread.delay in CLI apps that don't link the Thread module.

Fixes build failure (the build has been made more strict by turning off transitive dependencies)

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed May 10, 2024
1 parent 90c72f1 commit ff32fd9
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ocaml/xe-cli/newcli.ml
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ let main_loop ifd ofd permitted_filenames =
with
| Unix.Unix_error (_, _, _)
when !delay <= long_connection_retry_timeout ->
Thread.delay !delay ;
Unix.sleepf !delay ;
delay := !delay *. 2. ;
keep_connection ()
| e ->
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenopsd/cli/xn.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ let raw_console_proxy sockaddr =
(fun () -> Unix.close s)
with
| Unix.Unix_error (_, _, _) when !delay <= long_connection_retry_timeout ->
Thread.delay !delay ;
Unix.sleepf !delay ;
delay := !delay *. 2. ;
keep_connection ()
| e ->
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenopsd/xc/memory_breakdown.ml
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ let print_memory_field_values xc xs =
flush stdout

(** Sleeps for the given time period in seconds. *)
let sleep time_period_seconds = Thread.delay time_period_seconds
let sleep time_period_seconds = Unix.sleepf time_period_seconds

(** Prints a header line of memory field names, and then periodically prints a
line of memory field values. *)
Expand Down
2 changes: 1 addition & 1 deletion ocaml/xenopsd/xc/memory_summary.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let _ =
let finished = ref false in
while not !finished do
finished := !delay < 0. ;
if !delay > 0. then Thread.delay !delay ;
if !delay > 0. then Unix.sleepf !delay ;
flush stdout ;
let physinfo = Xenctrl.physinfo xc in
let one_page = 4096L in
Expand Down

0 comments on commit ff32fd9

Please sign in to comment.