I'm in the very unfortunate position of needing to interface nodejs's libuv and GLib's MainLoop on all three major OSes. I need to interleave both libuv's main loop and GLib's maing loop so that both parts of the project can be happy and live together. On unixes, that's easy enough because libuv returns a file descriptor to poll on:
GSource source;
// ...
g_source_add_unix_fd (&source->source,
uv_backend_fd (loop),
(GIOCondition) (G_IO_IN | G_IO_OUT | G_IO_ERR));
On Windows however, there isn't a file descriptor to poll on. What is available is a IO Completion Port HANDLE, under uv's loop->iocp. I'm not exactly sure how to proceed from here. I was thinking that I should probably be using the following function from GLIB:
void
g_source_add_poll (GSource *source,
GPollFD *fd);
But then I'd need to create a GPollFD from that and I'm not sure how to do it or if it's the right option. Any hint that could help me progress is welcome.
Relevant link: https://github.com/romgrk/node-gtk/blob/master/src/loop.cc#L68-L75