lwt icon indicating copy to clipboard operation
lwt copied to clipboard

Subclassing lwt engine doesn't really work.

Open toolslive opened this issue 9 years ago • 2 comments

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 a Lwt.file_descr on the side using a separate call to poll here, iso going through the engine. This breaks down if the resource represented by this Lwt.file_descr is not a resource that can be poll-ed (in this case an rsocket).
  • Lwt.file.descr has 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" via Obj.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).

toolslive avatar Apr 30 '16 11:04 toolslive

The poll portion seems related to #36 (though causing a different problem).

aantron avatar Apr 30 '16 15:04 aantron

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.

toolslive avatar May 01 '16 11:05 toolslive