diff options
| author | yo mama <pepper@scannerjammer.com> | 2015-04-04 01:00:59 -0700 |
|---|---|---|
| committer | yo mama <pepper@scannerjammer.com> | 2015-04-04 01:00:59 -0700 |
| commit | c7c22e3db1c826bcfb2bc66651ec480aae0d4ae0 (patch) | |
| tree | 8546df448afef40d3814d2581f4dacff7cebb87f /node_modules/webworker-threads/test/test07_sigkill.js | |
Diffstat (limited to 'node_modules/webworker-threads/test/test07_sigkill.js')
| -rw-r--r-- | node_modules/webworker-threads/test/test07_sigkill.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/node_modules/webworker-threads/test/test07_sigkill.js b/node_modules/webworker-threads/test/test07_sigkill.js new file mode 100644 index 0000000..4749c14 --- /dev/null +++ b/node_modules/webworker-threads/test/test07_sigkill.js @@ -0,0 +1,24 @@ + + +var Thread= require('webworker-threads'); + + +function cb (e,m) { + this.ctr= this.ctr ? this.ctr+1 : 1; + console.log('['+ this.id+ '] -> '+ this.ctr); + if (this.ctr >= 9) this.destroy(); + else this.eval('0', cb); +} + + +var i= +process.argv[2] || 1; +console.log('Using '+ i+ ' threads'); + +while (i--) { + Thread.create().eval('0', cb); +} + + +process.on('exit', function () { + console.log("process.on('exit') -> BYE!"); +}); |
