From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erbmR-0006KS-El for qemu-devel@nongnu.org; Thu, 01 Mar 2018 22:54:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erbmN-00077b-HA for qemu-devel@nongnu.org; Thu, 01 Mar 2018 22:54:47 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:37522 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1erbmN-00077L-CL for qemu-devel@nongnu.org; Thu, 01 Mar 2018 22:54:43 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B71A404084B for ; Fri, 2 Mar 2018 03:54:32 +0000 (UTC) Date: Fri, 2 Mar 2018 11:54:18 +0800 From: Peter Xu Message-ID: <20180302035418.GV27381@xz-mi> References: <20180301084438.13594-1-peterx@redhat.com> <20180301084438.13594-4-peterx@redhat.com> <2c8bac11-9f90-f79b-7b08-77f94a196c3a@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <2c8bac11-9f90-f79b-7b08-77f94a196c3a@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 03/15] qio: introduce qio_channel_add_watch_{full|source} List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, "Daniel P . Berrange" , Juan Quintela , =?utf-8?Q?Marc-Andr=C3=A9?= Lureau , Markus Armbruster , Stefan Hajnoczi , "Dr . David Alan Gilbert" On Thu, Mar 01, 2018 at 06:13:06PM +0100, Paolo Bonzini wrote: > On 01/03/2018 09:44, Peter Xu wrote: > > + * qio_channel_add_watch_source: > > + * @ioc: the channel object > > + * @condition: the I/O condition to monitor > > + * @func: callback to invoke when the source becomes ready > > + * @user_data: opaque data to pass to @func > > + * @notify: callback to free @user_data > > + * @context: gcontext to bind the source to > > + * > > + * Similar as qio_channel_add_watch(), but allows to specify context > > + * to run the watch source, meanwhile return the GSource object > > + * instead of tag ID, with the GSource referenced already. > > + * > > + * Note: callers is responsible to unref the source when not needed. > > + * > > + * Returns: the source pointer > > + */ > > +GSource *qio_channel_add_watch_source(QIOChannel *ioc, > > + GIOCondition condition, > > + QIOChannelFunc func, > > + gpointer user_data, > > + GDestroyNotify notify, > > + GMainContext *context); > > > > Just a small thing, this is a bit inconsistent with the rest of the > GSource API, where the g_source_attach is usually left to the caller > when a function returns GSource *. > > You might therefore name it instead qio_channel_create_watch, for > consistency with g_io_{add,create}_watch, and remove the "context" argument. Looks like there is already a qio_channel_create_watch() (io/channel.c). How about qio_channel_create_watch_attached()? Or... anything better? Thanks, -- Peter Xu