3 ms·
The main application runs in a single thread and then I/O activities happen in an event loop running with a small thread pool. Once one of those activities com
by zwigby 13y ago
The main application runs in a single thread and then I/O activities happen in an event loop running with a small thread pool.
Once one of those activities completes the event loop will give a signal to the main thread of the Node app and the callback will be executed.
Not sure if that helped or just confused everyone.
- oh_teh_meows 13y agoSo basically if you have an infinite loop in your app's one and only thread, none of the callbacks will happen because they have to run on that one thread?
- dsego 13y agoBasically, yes.
- catnaroek 13y agoRemember the "Node.js is Cancer" troll? It was pretty much about this.
- thedufer 13y agoYep. Similar to how an infinite loop in the browser will freeze up the page - the browser only gets to control to draw by putting a draw function in the event loop, so if you hog the thread, the page can't update.