summaryrefslogtreecommitdiff
path: root/node_modules/webworker-threads/test/test29_puts_callback_loop.js
diff options
context:
space:
mode:
authoryo mama <pepper@scannerjammer.com>2015-04-04 01:00:59 -0700
committeryo mama <pepper@scannerjammer.com>2015-04-04 01:00:59 -0700
commitc7c22e3db1c826bcfb2bc66651ec480aae0d4ae0 (patch)
tree8546df448afef40d3814d2581f4dacff7cebb87f /node_modules/webworker-threads/test/test29_puts_callback_loop.js
Diffstat (limited to 'node_modules/webworker-threads/test/test29_puts_callback_loop.js')
-rw-r--r--node_modules/webworker-threads/test/test29_puts_callback_loop.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/node_modules/webworker-threads/test/test29_puts_callback_loop.js b/node_modules/webworker-threads/test/test29_puts_callback_loop.js
new file mode 100644
index 0000000..d6cecae
--- /dev/null
+++ b/node_modules/webworker-threads/test/test29_puts_callback_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.");
+
+function ƒ () {
+ puts(" ["+ thread.id+ "]"+ (++i));
+ //if (!(i%1e3)) gc();
+}
+
+function callback (err, data) {
+ this.eval('ƒ()', callback);
+}
+
+pool.all.eval('i=0').all.eval(ƒ).all.eval('ƒ()', callback);