Last active
September 17, 2021 13:25
-
-
Save rvigneshw/23922e60f9e6e8fc68b51d098da83d6c to your computer and use it in GitHub Desktop.
Blocking the Event Loop of Node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let flag = false; | |
setTimeout(() => { | |
// this callback never gets called | |
// because event loop is blocked | |
flag = true; | |
}, 1000); | |
while (!flag) { | |
console.log("still waiting") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment