UNPKG

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