Skip to content

Commit

Permalink
Merge pull request #49 from mirage/lwt-pause-dont-sleep
Browse files Browse the repository at this point in the history
event loop: yield but don't sleep if there are paused tasks
  • Loading branch information
dinosaure authored Oct 19, 2022
2 parents bdc9d95 + 256c143 commit ec38df8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ let run t =
aux ())
else
let timeout =
match Time.select_next () with
| None -> Int64.add (Time.time ()) (Duration.of_day 1)
| Some tm -> tm
if Lwt.paused_count () > 0 then 0L
else
match Time.select_next () with
| None -> Int64.add (Time.time ()) (Duration.of_day 1)
| Some tm -> tm
in
MProf.Trace.(note_hiatus Wait_for_work);
evtchn_block_domain timeout;
Expand Down

0 comments on commit ec38df8

Please sign in to comment.