-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #447 from talex5/eio-main
eio_main: make EIO_BACKEND handling more uniform
- Loading branch information
Showing
10 changed files
with
37 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
(library | ||
(name eio_main) | ||
(public_name eio_main) | ||
(libraries eio_luv | ||
(select eio_main.ml from | ||
(eio_linux -> eio_main.linux.ml) | ||
( -> eio_main.default.ml)))) | ||
(libraries | ||
(select linux_backend.ml from | ||
(eio_linux -> linux_backend.enabled.ml) | ||
( -> linux_backend.disabled.ml)) | ||
(select luv_backend.ml from | ||
(eio_luv -> luv_backend.enabled.ml) | ||
( -> luv_backend.disabled.ml)) | ||
)) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
let force run fn = | ||
run ~fallback:(fun (`Msg msg) -> failwith msg) fn | ||
|
||
let run fn = | ||
match Sys.getenv_opt "EIO_BACKEND" with | ||
| Some ("io-uring" | "linux") -> force Linux_backend.run fn | ||
| Some "luv" -> force Luv_backend.run fn | ||
| None | Some "" -> | ||
Linux_backend.run fn ~fallback:(fun _ -> | ||
force Luv_backend.run fn | ||
) | ||
| Some x -> Fmt.failwith "Unknown Eio backend %S (from $EIO_BACKEND)" x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let run ~fallback _ = fallback (`Msg "The io_uring backend was disabled at compile-time") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let run ~fallback fn = Eio_linux.run ~fallback (fun env -> fn (env :> Eio.Stdenv.t)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let run ~fallback _ = fallback (`Msg "The Luv backend was disabled at compile-time") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let run ~fallback:_ fn = Eio_luv.run (fun env -> fn (env :> Eio.Stdenv.t)) |