1 |
|
2 |
|
3 | var Thread= require('../');
|
4 |
|
5 | function cb (e,m) {
|
6 | this.destroy();
|
7 | console.log('['+this.id+'].destroy()');
|
8 | //this.eval('0', cb);
|
9 | again();
|
10 | }
|
11 |
|
12 |
|
13 | function again () {
|
14 | Thread.create().eval('0', cb);
|
15 | }
|
16 |
|
17 |
|
18 | var i= +process.argv[2] || 1;
|
19 | console.log('Using '+ i+ ' threads');
|
20 |
|
21 |
|
22 |
|
23 | while (i--) {
|
24 | again();
|
25 | }
|
26 |
|
27 |
|
28 | process.on('exit', function () {
|
29 | console.log("process.on('exit') -> BYE!");
|
30 | });
|