On 28/05/2015 14:26, Fam Zheng wrote: > > > > Right, but the two sets of iohandlers are stored in different places, so > > > > it's obvious that you don't execute all of them. On the other hand, > > > > examining global state in aio_poll is really bad. > > > > > > OK. > > > > > > Would moving the ioeventfds to a new top level aio_loop_wait() be any > > > better? > > > That way no global state is needed. > > > > If we need pause/resume anyway due to block/mirror.c's use of > > block_job_defer_to_main_loop, I think this is not a problem anymore? > > I also hope to dedup the iohandler code with async.c, on top of [2]; and in > the > longer term, convert slirp to use AioContext API too, so that all > *_pollfds_fill() will not be necessary - the whole event loop goes epoll > style.
You can use separate AioContexts for that: one for block devices, one for (former) iohandlers. The two AioContexts then can live together in the main loop because the main loop just treats AioContexts as GSources. However, this does not help with ioeventfds, for which we need pause/resume. Paolo