Permalink
Browse files

++puts() tests

  • Loading branch information...
xk committed Mar 23, 2012
1 parent b525538 commit 92c85263c6fec5e4325c7a8b3a1195016dbe8fdd
Showing with 18 additions and 3 deletions.
  1. +1 −1 test/test27_puts_event_loop.js
  2. +3 −2 test/test28_puts_nextTick_loop.js
  3. +14 −0 test/test29_puts_callback_loop.js
@@ -8,7 +8,7 @@ pool.on('again', function onAgain () {
function ƒ () {
puts(" ["+ thread.id+ "]"+ (++i));
- thread.emit('again', 0);
+ thread.emit('again');
}
pool.all.eval(ƒ).all.eval('i=0').all.eval('ƒ()');
@@ -4,10 +4,11 @@ console.log("Using "+ i+ " threads.");
function program () {
var i= 0;
- (function ƒ () {
+ function ƒ () {
puts(" ["+ thread.id+ "]"+ (++i));
thread.nextTick(ƒ);
- })();
+ }
+ ƒ();
}
pool.all.eval(program).all.eval('program()');
@@ -0,0 +1,14 @@
+var i= parseInt(process.argv[2], 10) || 2;
+var pool= require('threads_a_gogo').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);

0 comments on commit 92c8526

Please sign in to comment.