Skip to content

Instantly share code, notes, and snippets.

@rvigneshw
Last active September 17, 2021 13:25
Show Gist options
  • Save rvigneshw/23922e60f9e6e8fc68b51d098da83d6c to your computer and use it in GitHub Desktop.
Save rvigneshw/23922e60f9e6e8fc68b51d098da83d6c to your computer and use it in GitHub Desktop.
Blocking the Event Loop of Node.js
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