diff options
Diffstat (limited to 'node_modules/webworker-threads/test/test25_delete_puts.js')
| -rw-r--r-- | node_modules/webworker-threads/test/test25_delete_puts.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/node_modules/webworker-threads/test/test25_delete_puts.js b/node_modules/webworker-threads/test/test25_delete_puts.js new file mode 100644 index 0000000..1e30fff --- /dev/null +++ b/node_modules/webworker-threads/test/test25_delete_puts.js @@ -0,0 +1,23 @@ +/* + +If you don't want a thread to have the privilege of writing to stdout, simply delete its global puts symbol + +*/ + +var Threads= require('webworker-threads'); + +function cb (err, msg) { + if (err) { + process.stdout.write("["+ this.id+ "] -> "+ err+ '\n'); + } + this.destroy(); +} + +function ƒ () { + puts("["+ thread.id+ "] -> puts('Hello!')\n"); +} + +var i= Math.abs(parseInt(process.argv[2], 10)) || 1; +console.log('Using '+ i+ ' threads'); + +Threads.createPool(i).all.eval('delete (global= this).puts; ('+ ƒ+ ')();', cb); |
