From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34186) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCOe4-0005qm-GA for qemu-devel@nongnu.org; Wed, 08 Nov 2017 06:35:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCOdz-0003l4-Gq for qemu-devel@nongnu.org; Wed, 08 Nov 2017 06:35:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51600) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eCOdz-0003jn-AT for qemu-devel@nongnu.org; Wed, 08 Nov 2017 06:35:43 -0500 Date: Wed, 8 Nov 2017 19:35:32 +0800 From: Peter Xu Message-ID: <20171108113532.GA4105@xz-mi> References: <20171106094643.14881-1-peterx@redhat.com> <20171106094643.14881-11-peterx@redhat.com> <20171107071131.GN16355@lemon> <20171108072542.GA2992@xz-mi> <20171108111844.GD2834@lemon> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20171108111844.GD2834@lemon> Subject: Re: [Qemu-devel] [RFC v3 10/27] monitor: create monitor dedicate iothread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Laurent Vivier , Juan Quintela , Markus Armbruster , qemu-devel@nongnu.org, mdroth@linux.vnet.ibm.com, Stefan Hajnoczi , marcandre.lureau@redhat.com, Paolo Bonzini , Jiri Denemark , "Dr . David Alan Gilbert" On Wed, Nov 08, 2017 at 07:18:44PM +0800, Fam Zheng wrote: > On Wed, 11/08 15:25, Peter Xu wrote: > > On Tue, Nov 07, 2017 at 03:11:31PM +0800, Fam Zheng wrote: > > > On Mon, 11/06 17:46, Peter Xu wrote: > > > > +static GMainContext *monitor_io_context_get(void) > > > > +{ > > > > + return iothread_get_g_main_context(mon_global.mon_iothread); > > > > +} > > > > + > > > > +static void monitor_iothread_init(void) > > > > +{ > > > > + mon_global.mon_iothread = iothread_create("monitor_iothread", > > > > + &error_abort); > > > > + /* > > > > + * GContext in iothread is using lazy init - the first time we > > > > + * fetch the context we'll have that initialized. > > > > + */ > > > > + monitor_io_context_get(); > > > > > > Why do you need an eager init here? > > > > I thought putting this line with IOThread creation will make it more > > clear that the IOThread is using GMainContext polling. I am not that > > strong to keep it, but I would prefer. > > The "iothread only starts using GMainContext polling after the lazy init > happens" is completely opaque to its user, so I don't think there is anything > but confusion to have this. Makes sense. Let me remove it. -- Peter Xu