Skip to content

Instantly share code, notes, and snippets.

@ciwolsey
Created November 25, 2014 14:30
Show Gist options
  • Select an option

  • Save ciwolsey/bcbae087f09afd0bad7a to your computer and use it in GitHub Desktop.

Select an option

Save ciwolsey/bcbae087f09afd0bad7a to your computer and use it in GitHub Desktop.
var Fiber = require('fibers');
var Future = require('fibers/future');
var ping = require('ping');
function hostCheck(host){
console.log("ping");
var future = new Future;
ping.sys.probe(host, function(alive){
future.return(alive);
console.log("pong");
});
return future.wait();
}
var a = function go(){
hostCheck("youtube.com");
hostCheck("youtube.com");
hostCheck("youtube.com");
hostCheck("youtube.com");
hostCheck("youtube.com");
hostCheck("youtube.com");
hostCheck("youtube.com");
hostCheck("youtube.com");
hostCheck("youtube.com");
hostCheck("youtube.com");
}.future();
a();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment