Received: from eggs.gnu.org ([2001:4830:134:3::10]:47469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBiG0-0007OH-7p for qemu-devel@nongnu.org; Tue, 20 Aug 2013 05:29:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBiFv-0005w2-Lw for qemu-devel@nongnu.org; Tue, 20 Aug 2013 05:29:44 -0400 Received: from mail.avalus.com ([2001:41c8:10:1dd::10]:58724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBiFv-0005vy-Fg for qemu-devel@nongnu.org; Tue, 20 Aug 2013 05:29:39 -0400 Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Alex Bligh In-Reply-To: <5213186F.3050900@linux.vnet.ibm.com> Date: Tue, 20 Aug 2013 10:29:04 +0100 Content-Transfer-Encoding: 7bit Message-Id: <41358186-3CEB-4AFB-9362-C3A46C19ADDB@alex.org.uk> References: <1376598879-18976-1-git-send-email-alex@alex.org.uk> <1376598879-18976-14-git-send-email-alex@alex.org.uk> <5212DDCA.5060906@linux.vnet.ibm.com> <5213186F.3050900@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCHv11 13/31] aio / timers: aio_ctx_prepare sets timeout from AioContext timers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: Kevin Wolf , Anthony Liguori , Stefan Hajnoczi , Jan Kiszka , qemu-devel@nongnu.org, liu ping fan , Alex Bligh , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net On 20 Aug 2013, at 08:19, Wenchao Xia wrote: > Thanks for the explanation. It seems *timeout is always set > to -1 before calling GSource's prepare(), so > "*timeout = qemu_soonest_timeout(*timeout, 10);" > will always get *timeout = 10, so this call can be saved. I believe that's incorrect too. glib *currently* calls the API that way, but there's nothing to say a future or past glub couldn't call each g_source with the same timeout pointer, with each g_source adjusting the timeout downwards. Or (for instance) call it with 0 for a non-blocking prepare. Therefore the implemented way is safer (only reducing the timeout). -- Alex Bligh