diff options
Diffstat (limited to 'node_modules/webworker-threads/test/test27_puts_event_loop.js')
| -rw-r--r-- | node_modules/webworker-threads/test/test27_puts_event_loop.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/node_modules/webworker-threads/test/test27_puts_event_loop.js b/node_modules/webworker-threads/test/test27_puts_event_loop.js new file mode 100644 index 0000000..fa1677b --- /dev/null +++ b/node_modules/webworker-threads/test/test27_puts_event_loop.js @@ -0,0 +1,14 @@ +var i= parseInt(process.argv[2], 10) || 2; +var pool= require('webworker-threads').createPool(i); +console.log("Using "+ i+ " threads."); + +pool.on('again', function onAgain () { + this.eval('ƒ()'); +}); + +function ƒ () { + puts(" ["+ thread.id+ "]"+ (++i)); + thread.emit('again'); +} + +pool.all.eval(ƒ).all.eval('i=0').all.eval('ƒ()'); |
