UNPKG

371 BJavaScriptView Raw
1var Threads= require('../');
2
3function cb (err, msg) {
4 if (err) {
5 process.stdout.write("["+ this.id+ "] -> "+ err+ '\n');
6 }
7 this.destroy();
8}
9
10function ƒ () {
11 puts("["+ thread.id+ "] -> puts('Hello!')\n");
12}
13
14var i= Math.abs(parseInt(process.argv[2], 10)) || 1;
15console.log('Using '+ i+ ' threads');
16
17Threads.createPool(i).all.eval(ƒ).all.eval('ƒ()', cb);