Skip to content

Instantly share code, notes, and snippets.

@mlegenhausen
Created December 8, 2011 11:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlegenhausen/1446757 to your computer and use it in GitHub Desktop.
Save mlegenhausen/1446757 to your computer and use it in GitHub Desktop.
Chain-Gang Issue #7
var chainGang = require('chain-gang');
var queue = chainGang.create();
var longTask = function(text) {
return function(worker) {
setTimeout(function() {
console.log(text);
worker.finish();
}, 1000);
}
};
queue.add(longTask('Hello World'));
queue.add(longTask('Nothing will happen'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment