All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	qemu devel <qemu-devel@nongnu.org>,
	"Daniel P . Berrange" <berrange@redhat.com>
Cc: "eddie . dong" <eddie.dong@intel.com>,
	Jason Wang <jasowang@redhat.com>,
	Li Zhijian <lizhijian@cn.fujitsu.com>
Subject: Re: [Qemu-devel] [RFC PATCH] Change g_source_attach(xx, NULL) to g_souce_attach(xx, g_main_context_get_thread_default())
Date: Mon, 20 Jun 2016 17:20:15 +0800	[thread overview]
Message-ID: <5767B54F.9040107@cn.fujitsu.com> (raw)
In-Reply-To: <4a359d04-a2cf-548f-c028-a342feb3329b@redhat.com>



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 <zhangchen.fnst@cn.fujitsu.com>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>
>

-- 
Thanks
zhangchen

  reply	other threads:[~2016-06-20  9:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20  8:23 [Qemu-devel] [RFC PATCH] Change g_source_attach(xx, NULL) to g_souce_attach(xx, g_main_context_get_thread_default()) Zhang Chen
2016-06-20  8:52 ` Paolo Bonzini
2016-06-20  9:20   ` Zhang Chen [this message]
2016-06-20 16:45 ` Eric Blake
2016-06-21  1:32   ` Zhang Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5767B54F.9040107@cn.fujitsu.com \
    --to=zhangchen.fnst@cn.fujitsu.com \
    --cc=berrange@redhat.com \
    --cc=eddie.dong@intel.com \
    --cc=jasowang@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.