This code change is callSoon(), which was introduced to fix recursion bugs, and allow developers to use it to set callbacks for every tick.
So callSoon(callbackProc) is just adding itself to the list of callbacks which going to be scheduled inside of poll().

This comment has been minimized.

Of course this is not expected, expected result is showed in first code sample,

So code inside of callbackProc() in 2nd code sample runs every one tick/poll() call and adds itself in callback list for next tick/poll() call. It must not create infinite loop, and it must allow IO operations and timers to be processed concurrently.

So this is not actually while true: discard, but recent additions to asyncdispatch, made it.

This comment has been minimized.

edited

Events should be dispatched in FIFO order. Or maybe is sleep not getting scheduled?. I can understand why pool would never return, though. FWIW, that is how Python asyncio works[0], and I've relied on this in JS more than once.