better handling of non-recursive source dispatching
Submitted by Allison (desrt)
Link to original bug (#687129)
Description
Presently, when dispatching a non-recursive source, the source is blocked.
This removes all file descriptors associated with that source from the main context list of pollfds. That involves some memory allocation, but if we move to epoll in the future it will involve making system calls.
All of this is in case we re-enter the main context via a recursive mainloop: we shouldn't dispatch the source again.
In reality, people don't often re-enter maincontexts. We should therefore delay the work of blocking the source during dispatch to be handled only in the case that the user does re-enter the loop, in order to avoid the unnecessary shuffling.