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

Loading…
Cancel
Save