4 ms·
If you've got a thread running one event loop, how could you signal to it to temporarily break out of that loop and run a different event loop for a while?
by mcronce 4y ago
If you've got a thread running one event loop, how could you signal to it to temporarily break out of that loop and run a different event loop for a while?
- aaaaaaaaaaab 4y agoThe while(1) part of the event loop would be outside, provided by the stdlib. Each runtime would provide a set of FDs that they want to monitor, and a function to execute a single iteration of their event loop. The while(1) loop would then be calling each runtime in a round-robin fashion, then go sleep while waiting on the union of all the runtimes’ FD sets. It would be sort of an “event loop of event loops”.
- stormbrew 4y agoWhat you've just described is ... an executor runtime. Even if you boil it down to doing "only" that, you still can only have one of that per thread, and there isn't just one way to implement that.