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