From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEvNM-0004pf-P4 for qemu-devel@nongnu.org; Mon, 20 Jun 2016 05:20:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bEvNJ-0005tg-JX for qemu-devel@nongnu.org; Mon, 20 Jun 2016 05:20:12 -0400 Received: from [59.151.112.132] (port=40412 helo=heian.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bEvNI-0005q3-TC for qemu-devel@nongnu.org; Mon, 20 Jun 2016 05:20:09 -0400 References: <1466410992-10462-1-git-send-email-zhangchen.fnst@cn.fujitsu.com> <4a359d04-a2cf-548f-c028-a342feb3329b@redhat.com> From: Zhang Chen Message-ID: <5767B54F.9040107@cn.fujitsu.com> Date: Mon, 20 Jun 2016 17:20:15 +0800 MIME-Version: 1.0 In-Reply-To: <4a359d04-a2cf-548f-c028-a342feb3329b@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC PATCH] Change g_source_attach(xx, NULL) to g_souce_attach(xx, g_main_context_get_thread_default()) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu devel , "Daniel P . Berrange" Cc: "eddie . dong" , Jason Wang , Li Zhijian On 06/20/2016 04:52 PM, Paolo Bonzini wrote: > > On 20/06/2016 10:23, Zhang Chen wrote: >> We want to poll and handle chardev in another thread >> other than main loop. > Can you explain this better? For example, we use this in codes: + qemu_chr_add_handlers(s->chr_sec_in, compare_chr_can_read, + compare_sec_chr_in, NULL, s); when data come to s->chr_sec_in ,we want to make compare_sec_chr_in() run in another thread rather than main loop. Thanks Zhang Chen > > Paolo > >> But qemu_chr_add_handlers() can only >> work for global default context other than thread default context. >> So we use g_souce_attach(xx, g_main_context_get_thread_default()) >> replace g_source_attach(xx, NULL) to attach g_source. >> Comments form jason. >> >> Signed-off-by: Zhang Chen >> Signed-off-by: Jason Wang >> --- > > -- Thanks zhangchen