-
Notifications
You must be signed in to change notification settings - Fork 24
Description
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.