lwt
lwt copied to clipboard
Subclassing lwt engine doesn't really work.
I recently worked on the ordma package and needed to implement a new Lwt engine, based on librdmacm's rselect. There were some problems:
- Lwt checks for readability (
Lwt_unix.readable) on aLwt.file_descron the side using a separate call to poll here, iso going through the engine. This breaks down if the resource represented by thisLwt.file_descris not a resource that can bepoll-ed (in this case an rsocket). Lwt.file.descrhas some internal state (the state attribute )that cannot be manipulated through the interface. This forced me into using a private copy the definition, and a "cast" viaObj.magic, which is really ugly. A typical example is the close call.
Basically, what I'm saying is that there is an API to plug in your own lwt engine, but that it doesn't really work when you actually try to do this (or I wasn't smart enough to figure out how to do this cleanly).
The poll portion seems related to #36 (though causing a different problem).
In case of ordma, the int that's inside the Lwt_unix.file_descr's fd field might not even be a valid file descriptor.