genny icon indicating copy to clipboard operation
genny copied to clipboard

Could add api : fork(), join() like suspend?

Open skyblue opened this issue 9 years ago • 0 comments

suspend(function*() {
    var fileNames = yield fs.readdir('test', suspend.resume());
    fileNames.forEach(function(fileName) {
        fs.readFile('test/' + fileName, 'utf8', suspend.fork());
    });
    var files = yield suspend.join();
})();

the fork() and join() are helpful. Although the "yield resume" close but need to iterate twice

skyblue avatar Jun 06 '15 11:06 skyblue