Skip to content

eio does not support multiple loops #14

@paddybyers

Description

@paddybyers

uv-eio.c contains this:

/* TODO remove me! /
static uv_loop_t
main_loop;

This is because the two poll callbacks uv_eio_want_poll and uv_eio_done_poll are called asynchronously without any context, and it is not possible to determine which loop the events are associated with. Normally, this isn't a problem, but it becomes a problem if an application wants to have multiple active loops in a single process.

Support for multiple instances is sought for the Android port, and I'm now running into this problem.

My thought was to put the required information into the eio_req via a new poll_data field, and for this field to be populated as required whenever the calling application constructs the eio_req.

The proposed changes are here.

A perhaps cleaner but more intrusive change would be to add the poll_data as an explicit argument into each of the eio_xxx constructors.

This has been tested with multiple simultaneous node instances in a single process and seems to be working OK.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions