Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eio_posix: ignore some errors writing to the wake up pipe #600

Merged
merged 1 commit into from
Aug 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib_eio_posix/sched.ml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,15 @@ let wakeup t =
Rcfd.use t.eventfd
~if_closed:ignore (* Domain has shut down (presumably after handling the event) *)
(fun fd ->
(* This can fail if the pipe is full, but then a wake up is pending anyway. *)
ignore (Unix.single_write fd wake_buffer 0 1 : int);
try
ignore (Unix.single_write fd wake_buffer 0 1 : int)
with
| Unix.Unix_error ((Unix.EAGAIN | EWOULDBLOCK), _, _) ->
(* If the pipe is full then a wake up is pending anyway. *)
()
| Unix.Unix_error (Unix.EPIPE, _, _) ->
(* We're shutting down; the event has already been processed. *)
()
)

(* Safe to call from anywhere (other systhreads, domains, signal handlers, GC finalizers) *)
Expand Down