Can't explain nodejs behavior. I have code:
while (true) {
setTimeout(() => console.log(1), 0)
}
And this script just hanging...
How come? I've been thinking setTimeout
is non-blocking and asynchronous, and nodejs use timers
event loop phase for scheduling setTimeout
callbacks... but it seems like event loop blocked...