-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Execution order: setImmediate, setTimeout, fs.stat, fs.readFile #7709
Comments
I don't think that your report fully holds. Try this: https://gist.github.com/indutny/3ffc37502cf07b1b2c4b I get:
|
Regarding I/O, it doesn't mean that calling |
Thanks for comments. timeout Can't believe why this is happening. |
What node.js version are we talking about, and what OS are you running it on? |
@indutny I'm seeing non-deterministic different orders. I've tested 0.11.13 and 0.10.28 on OS X. From what I've seen, immediate1 always comes before immediate 2, but there is no relation between the immediates and timeout. However, this behavior seems to be in line with this comment - #6034 (comment) |
@cjihrig indeed. Looks like something in var Timer = process.binding('timer_wrap').Timer;
setImmediate(function() {
console.log('immediate 1');
});
var t = new Timer();
t[Timer.kOnTimeout] = function () {
console.log('timeout');
}
t.start(0, 0);
setImmediate(function() {
console.log('immediate 2');
});
|
I'm just crap shooting this, but it might have to do with the fact that on While this is slightly perplexing, I don't believe Node has ever made the Guess what I'm getting at is, is this really an issue or just an oddity of |
Mac OSX 10.6.8, |
Hi,
Execution order is different.
setImmediate is executing before fs.readFile and after fs.stat.
setImmediate is executing after setTimeout for time = 0.
Per Documentation:
setImmediate should execute after I/O operation callbacks.
setImmediate should execute before setTimeout.
Thanks
The text was updated successfully, but these errors were encountered: