3 ms·
>Runtime.JS uses global non-blocking event loop to dispatch tasks for the whole system. Preemption is supported by design (and by V8), but haven't been implemen
by ah- 12y ago
>Runtime.JS uses global non-blocking event loop to dispatch tasks for the whole system. Preemption is supported by design (and by V8), but haven't been implemented yet.
How would you implement preemption in an event loop based system? Can you just stop execution of functions in the middle, run a different function for some time and then continue with the original one?
- shayief 12y agoYes, V8 supports this for contexts. Each program runs in its own context. Engine puts interrupt guard checks into every function and every loop. So its possible to interrupt context even in a middle of infinite loop.