-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add support for selecting the libev backend #269
Conversation
Thanks, looks good. I have no strong objection to making the type abstract, but why not just expose a (maybe polymorphic) variant, and type the argument to I've fixed the problem with the CI builds, in |
c6d78f0
to
c0c8597
Compare
That's a reasonable way to do things, too. There are a couple of reasons why I prefer to use an abstract type:
That said, I don't mind switching to a list, if you prefer. Or, since the abstract interface is compatible with lists, there's always the option of switching later if you're happy to merge this as is. |
val devpoll : t | ||
val port : t | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be convenient to have a pp
function here to have a human-readable representation of the abstract type, for logging purposes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. I've added one in 268bc37.
4a60522
to
ffdb93f
Compare
268bc37
to
55e9817
Compare
Merged with trivial changes in #294. Thanks! |
This pull request adds support for selecting the backend (
poll
,select
,kqueue
, etc.) used by the libev engine. (The libev man page has some fairly forthright notes about the tradeoffs between the various backends.)The backends are exposed as members of an abstract type,
Ev_backend.t
in the Lwt engine module:Keeping the type abstract leaves open the possibility to extend the interface in a backwards-compatible way in the future. For example, it is sometimes useful to pass multiple backend flags, leaving libev to select the best backend from those available; this could be supported in Lwt by the addition of a function of type
Ev_backend.t -> Ev_backend.t -> Ev_backend.t
. For the moment there is only support for passing a single backend.The backend is passed as an argument to the
libev
class:The addition of arguments to
libev
is a backwards incompatible change, and client code must be changed to add a unit argument:new libev
However, this is a one-time cost: if the
libev
interface is extended with additional optional flags in the future, no further changes to client code will be needed.