Skip to content

Commit

Permalink
Merge pull request #470 from talex5/linux-exit
Browse files Browse the repository at this point in the history
eio_linux: wait for uring to finish before exiting
  • Loading branch information
talex5 authored Mar 23, 2023
2 parents 2a0c5ac + f7fa3ad commit 0a96e92
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions lib_eio_linux/sched.ml
Original file line number Diff line number Diff line change
Expand Up @@ -470,15 +470,18 @@ let run ~extra_effects st main arg =
Switch.on_release sw (fun () ->
Fd.close st.eventfd
);
result := Some (
Fiber.first
(fun () -> main arg)
(fun () -> monitor_event_fd st)
)
Fiber.fork_daemon ~sw (fun () -> monitor_event_fd st);
match main arg with
| x -> result := Some (Ok x)
| exception ex ->
let bt = Printexc.get_raw_backtrace () in
result := Some (Error (ex, bt))
)
)
in
Option.get !result
match Option.get !result with
| Ok x -> x
| Error (ex, bt) -> Printexc.raise_with_backtrace ex bt

type config = {
queue_depth : int;
Expand Down

0 comments on commit 0a96e92

Please sign in to comment.