lwt
lwt copied to clipboard
Tell libev to use kqueue by default on macOS
On macOS, libev seems to default, too often, to select(2)
. Given that a major reason for using libev in the first place is to avoid select(2)
, we should have Lwt ask libev for its kqueue
backend explicitly.
In other words, on macOS, new Lwt_engine.libev ()
should default to new Lwt_engine.(libev ~backend:Ev_backend.kqueue ())
. See class Lwt_engine.libev
.
cc @yallop, @anmonteiro as people who have been bitten by this.
See also #269, in which @yallop added support for choosing the backend.
libev should probably also be chosen by default on mac:
https://github.com/ocsigen/lwt/blob/ee466e23979644beb30f2d51a9835f5ffe34a3ab/src/unix/config/discover.ml#L860-L868
This also seems to be a duplicate of #87.
I am currently having problems with this. When I run:
Lwt_engine.set (new Lwt_engine.libev ~backend:Lwt_engine.Ev_backend.kqueue ());
I get a segmentation fault. Are there any workarounds for this?
Platform: macOS 12.5
@Marchhill what Lwt version are you using? Can you reproduce on the HEAD of the master branch?
What ocaml version are you using?
I don't have a mac so I can't reproduce, but having the added info could help someone else check.