Re: [Qemu-devel] [RFC PATCH] Change g_source_attach(xx, NULL) to g_souce_attach(xx, g_main_context_get_thread_default())

2016-06-20 Thread Zhang Chen
On 06/21/2016 12:45 AM, Eric Blake wrote: On 06/20/2016 02:23 AM, Zhang Chen wrote: Subject line is too long, missing a 'topic:' prefix, and has a typo (souce). Suggest: qemu-char: Fix context for g_source_attach() OK~~ I will fix it in next version. We want to poll and handle chardev

Re: [Qemu-devel] [RFC PATCH] Change g_source_attach(xx, NULL) to g_souce_attach(xx, g_main_context_get_thread_default())

2016-06-20 Thread Eric Blake
On 06/20/2016 02:23 AM, Zhang Chen wrote: Subject line is too long, missing a 'topic:' prefix, and has a typo (souce). Suggest: qemu-char: Fix context for g_source_attach() > We want to poll and handle chardev in another thread > other than main loop. But qemu_chr_add_handlers() can only >

Re: [Qemu-devel] [RFC PATCH] Change g_source_attach(xx, NULL) to g_souce_attach(xx, g_main_context_get_thread_default())

2016-06-20 Thread Zhang Chen
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, +

Re: [Qemu-devel] [RFC PATCH] Change g_source_attach(xx, NULL) to g_souce_attach(xx, g_main_context_get_thread_default())

2016-06-20 Thread Paolo Bonzini
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? 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,

[Qemu-devel] [RFC PATCH] Change g_source_attach(xx, NULL) to g_souce_attach(xx, g_main_context_get_thread_default())

2016-06-20 Thread Zhang Chen
We want to poll and handle chardev in another thread other than main loop. 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.