On Thu, Aug 15, 2013 at 09:34:21PM +0100, Alex Bligh wrote: > @@ -150,13 +150,14 @@ aio_ctx_prepare(GSource *source, gint *timeout) > { > AioContext *ctx = (AioContext *) source; > QEMUBH *bh; > + int deadline; > > for (bh = ctx->first_bh; bh; bh = bh->next) { > if (!bh->deleted && bh->scheduled) { > if (bh->idle) { > /* idle bottom halves will be polled at least > * every 10ms */ > - *timeout = 10; > + *timeout = qemu_soonest_timeout(*timeout, 10); > } else { > /* non-idle bottom halves will be executed > * immediately */
I agree with Wenchao: The docs explicitly say that .prepare() can set timeout to the maximum timeout value that is required. It then explains that the "actual timeout used" is the minimum of all timeout values - it's not our job to calculate the minimum, glib will do that after calling all .prepare() functions. I would drop this hunk. Stefan