From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBjyl-0006sr-9B for qemu-devel@nongnu.org; Tue, 20 Aug 2013 07:20:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VBjyd-0005A3-7D for qemu-devel@nongnu.org; Tue, 20 Aug 2013 07:20:03 -0400 Received: from e28smtp01.in.ibm.com ([122.248.162.1]:47746) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VBjyc-00059X-G6 for qemu-devel@nongnu.org; Tue, 20 Aug 2013 07:19:55 -0400 Received: from /spool/local by e28smtp01.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 20 Aug 2013 16:40:59 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id 737253940058 for ; Tue, 20 Aug 2013 16:49:37 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7KBLIwk37159028 for ; Tue, 20 Aug 2013 16:51:18 +0530 Received: from d28av01.in.ibm.com (localhost [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7KBJj6o023510 for ; Tue, 20 Aug 2013 16:49:45 +0530 Message-ID: <521350BE.5@linux.vnet.ibm.com> Date: Tue, 20 Aug 2013 19:19:26 +0800 From: Wenchao Xia MIME-Version: 1.0 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> <41358186-3CEB-4AFB-9362-C3A46C19ADDB@alex.org.uk> In-Reply-To: <41358186-3CEB-4AFB-9362-C3A46C19ADDB@alex.org.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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: Alex Bligh Cc: Kevin Wolf , Anthony Liguori , Jan Kiszka , qemu-devel@nongnu.org, liu ping fan , Stefan Hajnoczi , Paolo Bonzini , MORITA Kazutaka , rth@twiddle.net 于 2013-8-20 17:29, Alex Bligh 写道: > > 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 So it is an undefined value, should avoid use it? For example, other gsource have minimum timeout of 5, and aio_ctx_prepare() is called with 0, then returned timeout is 0, but it is supposed to work with timeout 5 as the glib doc described: https://developer.gnome.org/glib/2.32/glib-The-Main-Event-Loop.html#GSourceFuncs That is my opinion, but I haven't read other project's code about prepare() usage, so can't be sure. Guess maintainer can give a conclusion. > non-blocking prepare. Therefore the implemented way > is safer (only reducing the timeout). > -- Best Regards Wenchao Xia