Skip to content

Commit d15cb7a

Browse files
committed
prelude: prefer poll over select, except if libev
1 parent beb1060 commit d15cb7a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

prelude.ml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,13 @@ let call_me_maybe f x =
5454
match f with
5555
| None -> ()
5656
| Some f -> f x
57+
58+
(*
59+
If libev backend is available, do nothing (lwt uses it as default).
60+
Otherwise, prefer poll over select, because select can only monitor fds up to 1024,
61+
and poll is guaranteed to be available without the fd limitation.
62+
*)
63+
let () =
64+
if not (Lwt_config._HAVE_LIBEV && Lwt_config.libev_default) then begin
65+
Lwt_engine.set @@ new Lwt_engines.poll
66+
end

0 commit comments

Comments
 (0)