Skip to content

Commit

Permalink
autoformat
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesm committed May 18, 2024
1 parent 3cd1610 commit 27451e6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 6 additions & 3 deletions lib/time.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ type t = int64
module SleepQueue = Binary_heap.Make (struct
type t = Mirage_time.sleep

let compare Mirage_time.{ time = t1; _ } Mirage_time.{ time = t2; _ } = compare t1 t2
let compare Mirage_time.{ time = t1; _ } Mirage_time.{ time = t2; _ } =
compare t1 t2
end)

(* Threads waiting for a timeout to expire: *)
let sleep_queue =
let dummy =
Mirage_time.{ time = time (); canceled = false; thread = Lwt.wait () |> snd }
Mirage_time.
{ time = time (); canceled = false; thread = Lwt.wait () |> snd }
in
SleepQueue.create ~dummy 0

Expand Down Expand Up @@ -73,6 +75,7 @@ let rec get_next_timeout () =
let select_next () =
(* Transfer all sleepers added since the last iteration to the main
sleep queue: *)
List.iter (fun e -> SleepQueue.add sleep_queue e)
List.iter
(fun e -> SleepQueue.add sleep_queue e)
(Mirage_time.new_sleepers ());
get_next_timeout ()
6 changes: 4 additions & 2 deletions lib/xen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,15 @@ module Export = struct
match try_end_access ~release_ref g with
| Ok () -> Lwt.return_unit
| Error `Busy ->
Mirage_time.sleep_ns ten_seconds_in_ns >>= fun () -> end_access ~release_ref g
Mirage_time.sleep_ns ten_seconds_in_ns >>= fun () ->
end_access ~release_ref g

let rec unshare ~release_refs t =
match try_unshare ~release_refs t with
| Ok () -> Lwt.return_unit
| Error `Busy ->
Mirage_time.sleep_ns ten_seconds_in_ns >>= fun () -> unshare ~release_refs t
Mirage_time.sleep_ns ten_seconds_in_ns >>= fun () ->
unshare ~release_refs t

let share_pages ~domid ~count ~writable =
(* First allocate a list of n pages. *)
Expand Down

0 comments on commit 27451e6

Please sign in to comment.