Skip to content
/ uvrun Public
forked from creationix/uvrun

Tiny node module to expose uv_run and uv_run_once to JavaScript

Notifications You must be signed in to change notification settings

gitzalm/uvrun

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UVRun

Bindings to the uvrun functions in libuv to node.js.

Normally these functions are implicitly called by node itself.

By using runOnce, you can have finer grained control of the event loop and know when it's idle.

var runOnce = require('uvrun').runOnce;
 
// Do something here, like make a server to keep the event loop busy
var TCP = process.binding('tcp_wrap').TCP;
var server = new TCP();
server.onconnection = function () {
  console.log("connection!");
};
server.bind("0.0.0.0", 3000);
server.listen(511);
 
// Visualize each event loop tick using a custom event loop.
console.log("Waiting for events...");
do {
  var ret = runOnce();
  console.log("tick", Date.now());
} while(ret);
// If the code gets here, there are no events left and node's built-in uv_run won't block.

About

Tiny node module to expose uv_run and uv_run_once to JavaScript

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 67.3%
  • Python 32.7%