From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42083) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8maQ-0000yP-HO for qemu-devel@nongnu.org; Mon, 12 Aug 2013 03:30:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V8maK-0003QI-5b for qemu-devel@nongnu.org; Mon, 12 Aug 2013 03:30:42 -0400 Received: from mx3-phx2.redhat.com ([209.132.183.24]:42038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V8maJ-0003QA-Pi for qemu-devel@nongnu.org; Mon, 12 Aug 2013 03:30:35 -0400 Date: Mon, 12 Aug 2013 03:30:28 -0400 (EDT) From: Paolo Bonzini Message-ID: <788101843.267798.1376292628614.JavaMail.root@redhat.com> In-Reply-To: <520884C0.60208@linux.vnet.ibm.com> References: <5205B251.2060907@linux.vnet.ibm.com> <5205F3CA.1060009@redhat.com> <520884C0.60208@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] Convert AioContext to Gsource sub classes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: Kevin Wolf , Anthony Liguori , Ping Fan Liu , Stefan Hajnoczi , Michael Roth , qemu-devel > 1) rename AioContext to AioSource. > This is my major purpose, which declare it is not a "context" concept, > and GMainContext is the entity represent the thread's activity. Note that the nested event loops in QEMU are _very_ different from glib nested event loops. In QEMU, nested event loops only run block layer events. In glib, they run all events. That's why you need AioContext. > 2) Break AioSource into FdSource and BhSource. > This make custom code less and simpler, one Gsource for one kind of > job. It is not necessary but IMHO it will make things clear when add > more things into main loop: add a new Gsource sub class, avoid to > always have relationship with AioContext. But this is only complicating things work since users rely on both file- descriptor APIs and bottom half APIs. > >> More reasons: > >> When I thinking how to bind library code to a thread context, it may > >> need to add Context's concept into API of block.c. If I use AioContext, > >> there will need a wrapper API to run the event loop. But If I got > >> glib's GmainContext, things become simple. You already have it because AioContext is a GSource. You do not need to expose the AioContext, except as a GSource. Paolo