Browse Source

Change isolate test to demo EIO bug

v0.7.4-release
Ryan Dahl 13 years ago
committed by Ben Noordhuis
parent
commit
2c560c5405
  1. 31
      test/simple/test-isolates.js

31
test/simple/test-isolates.js

@ -1,4 +1,5 @@
var fs = require('fs'); var fs = require('fs');
var http = require('http');
console.log("count: %d", process._countIsolate()); console.log("count: %d", process._countIsolate());
@ -7,21 +8,31 @@ if (process.tid === 1) {
//process._joinIsolate(isolate); //process._joinIsolate(isolate);
console.error("master"); console.error("master");
fs.stat(__dirname, function(err, stat) { fs.stat(__dirname, function(err, stat) {
if (err) { if (err) throw err;
console.error("thread 1 error!"); console.error('thread 1', stat.mtime);
throw err;
}
console.error('thread 1', stat);
}); });
setTimeout(function() {
fs.stat(__dirname, function(err, stat) {
if (err) throw err;
console.error('thread 1', stat.mtime);
});
}, 500);
console.log("thread 1 count: %d", process._countIsolate()); console.log("thread 1 count: %d", process._countIsolate());
} else { } else {
console.error("slave"); console.error("slave");
fs.stat(__dirname, function(err, stat) { fs.stat(__dirname, function(err, stat) {
if (err) { if (err) throw err;
console.error("thread 2 error!"); console.error('thread 2', stat.mtime);
throw err;
}
console.error('thread 2', stat);
}); });
setTimeout(function() {
fs.stat(__dirname, function(err, stat) {
if (err) throw err;
console.error('thread 2', stat.mtime);
});
}, 500);
console.error("thread 2 count: %d", process._countIsolate()); console.error("thread 2 count: %d", process._countIsolate());
} }

Loading…
Cancel
Save