5 ms·
There is no preemption in Javascript. It is based on cooperative multitasking[1] (your await statements and non-blocking callback) which is the opposite of pree
by sakex 2y ago
There is no preemption in Javascript. It is based on cooperative multitasking[1] (your await statements and non-blocking callback) which is the opposite of preemption.
[1]https://en.wikipedia.org/wiki/Cooperative_multitasking#:~:text=Cooperative%20multitasking%2C%20also%20known%20as,running%20process%20to%20another%20process https://en.wikipedia.org/wiki/Cooperative_multitasking#:~:te....
- ndndjdueej 2y agoAs anyone who has done the old setTimeout(fn, 0) trick in the browser probably knows.
- Feathercrown 2y agoThey even created setImmediate(fn) for this purpose
- orlp 2y agoIf every line had an implicit await then it is indistinguishable from pre-emption, which I think is the point the person you're replying to is trying to make.