From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEpVK-0000qU-Ey for qemu-devel@nongnu.org; Sun, 19 Jun 2016 23:04:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bEpVG-0004Rd-5q for qemu-devel@nongnu.org; Sun, 19 Jun 2016 23:04:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEpVG-0004RP-0U for qemu-devel@nongnu.org; Sun, 19 Jun 2016 23:03:58 -0400 References: <1464180653-12637-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> <574BB14F.6050303@redhat.com> <574D0AEF.7080804@cn.fujitsu.com> <574D2C3B.4000603@redhat.com> <574D4B24.3010603@cn.fujitsu.com> <574D7040.6090602@redhat.com> <57635FA4.60907@cn.fujitsu.com> From: Jason Wang Message-ID: <57675D18.6030207@redhat.com> Date: Mon, 20 Jun 2016 11:03:52 +0800 MIME-Version: 1.0 In-Reply-To: <57635FA4.60907@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH V4 0/4] Introduce COLO-compare List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhang Chen , qemu devel Cc: "eddie . dong" , zhanghailiang , Li Zhijian , "Dr . David Alan Gilbert" On 2016=E5=B9=B406=E6=9C=8817=E6=97=A5 10:25, Zhang Chen wrote: > Hi~ jason. > > I tried a lot of ways to make it run in compare thread, but it not work= . > > Because that: > void g_main_context_push_thread_default (GMainContext *context); > Acquires context and sets it as the thread-default context for the=20 > current thread. > > So, this function g_main_context_push_thread_default() just can set=20 > thread-default context, > not the global default context. and I can't find a function to set=20 > global default context in glib. > The qemu's QIOChannel uses g_source_attach(source, NULL); to attach=20 > GSource. > g_source_attach (GSource *source, > GMainContext *context); > > context > a GMainContext (if NULL, the default context will be used). > > But he not say "the default context" is global default context or=20 > thread-default context. > So I read glib codes find that: > guint > g_source_attach (GSource *source, > GMainContext *context) > { > ..... > if (!context) > context =3D g_main_context_default (); > ..... > } > > g_main_context_default () > Returns the global default main context. > > So...I think we can't make qemu_chr_add_handlers() run in colo thread=20 > in this way. > Do you have any comments about that?=20 How about (like I suggest previously) just use g_souce_attach(x, g_main_context_get_thread_default()); in qemu's QIOChannel code?