Created
November 25, 2014 14:29
-
-
Save ciwolsey/fdaeb64019f142f1adfa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | |
| } | |
| var a = function go(){ | |
| hostCheck("youtube.com").wait; | |
| hostCheck("youtube.com").wait; | |
| hostCheck("youtube.com").wait; | |
| hostCheck("youtube.com").wait; | |
| hostCheck("youtube.com").wait; | |
| hostCheck("youtube.com").wait; | |
| hostCheck("youtube.com").wait; | |
| hostCheck("youtube.com").wait; | |
| hostCheck("youtube.com").wait; | |
| hostCheck("youtube.com").wait; | |
| }.future(); | |
| a(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment