Created
November 8, 2011 23:55
-
-
Save willconant/1349764 to your computer and use it in GitHub Desktop.
Tim Caswell's Fiber idea prototyped with Marcel Laverdet's node-fibers
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
require('fibers'); | |
module.exports = function(fn) { | |
Fiber(function() { | |
var fiber = Fiber.current; | |
var wait = yield; | |
var resume = function() { | |
fiber.run(arguments); | |
}; | |
fn(resume, wait); | |
}).run(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment