Many system libraries are based on GLib, and work with GLib event loop. For writing a node.js binding with such libraries, libev is the only way to integrate event loop between node.js event loop and GLib main context. The problem is that libev is deprecated since 0.8 node.js cause modules which depends on libev will be broken on latest and higher version. Nothing works if there is no libev.
In fact, upstream announced that libuv is being only one way to handle all low-level operations(I/O, threads, timer and poll). However, there is no people to re-work integration of GLib event loop with new libuv APIs, even six months have passed already. This problem must be solved if we want to write system program and native application in Node.js.
Besides, modules which works with GLib event loop have own implementation for event loop integration in the past, conflict occurs properly between each module. Your program always crashes or hangs when normal process of event loop is interrupted by another module.
For theses reasons, I wrote a Node.js module "GContext" to do GLib main context integration, used libuv APIs to support latest version of Node.js. It's an individual module, so it's possible to be used directly by other modules. As long as it uses GContext module, it can run a GLib event loop on Node.js and share this loop with other modules. There is no need to re-implement this mechanism by themselves anymore.
You can install it from NPM directly:
npm install gcontext
Initiate main context and run a GLib loop on Node.js event engine:
var GContext = require('gcontext'); GContext.init();