Skip to content

Subclassing lwt engine doesn't really work. #237

@toolslive

Description

@toolslive

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).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions