Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

more puts() tests

  • Loading branch information...
commit 490763a0fbaf7c68dba575b053aa476957e1f854 1 parent 3efe97d
xk authored
8 test/test27_puts_event_loop.js
View
@@ -1,7 +1,7 @@
-var threads_a_gogo= require('threads_a_gogo');
-var pool= threads_a_gogo.createPool(2);
+var i= parseInt(process.argv[2], 10) || 2;
+var pool= require('threads_a_gogo').createPool(i);
+console.log("Using "+ i+ " threads.");
-var i= 0;
pool.on('again', function onAgain () {
this.eval('ƒ()');
});
@@ -11,4 +11,4 @@ function ƒ () {
thread.emit('again', 0);
}
-pool.all.eval(ƒ).all.eval('i=0').all.eval('ƒ()').all.eval('ƒ()').all.eval('ƒ()');
+pool.all.eval(ƒ).all.eval('i=0').all.eval('ƒ()');
13 test/test28_puts_nextTick_loop.js
View
@@ -0,0 +1,13 @@
+var i= parseInt(process.argv[2], 10) || 2;
+var pool= require('threads_a_gogo').createPool(i);
+console.log("Using "+ i+ " threads.");
+
+function program () {
+ var i= 0;
+ (function ƒ () {
+ puts(" ["+ thread.id+ "]"+ (++i));
+ thread.nextTick(ƒ);
+ })();
+}
+
+pool.all.eval(program).all.eval('program()');
Please sign in to comment.
Something went wrong with that request. Please try again.