[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH V4 0/4] Introduce COLO-compare

From: Zhang Chen
Subject: Re: [Qemu-devel] [RFC PATCH V4 0/4] Introduce COLO-compare
Date: Mon, 20 Jun 2016 11:27:33 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0

On 06/20/2016 11:03 AM, Jason Wang wrote:

On 2016年06月17日 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 current thread.

So, this function g_main_context_push_thread_default() just can set thread-default context, not the global default context. and I can't find a function to set global default context in glib. The qemu's QIOChannel uses g_source_attach(source, NULL); to attach GSource.
g_source_attach (GSource *source,
                 GMainContext *context);

a GMainContext (if NULL, the default context will be used).

But he not say "the default context" is global default context or thread-default context.
So I read glib codes find that:
g_source_attach (GSource *source,
                 GMainContext *context)
if (!context)
    context = 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 in this way. Do you have any comments about that?

How about (like I suggest previously) just use

g_souce_attach(x, g_main_context_get_thread_default());

in qemu's QIOChannel code?

I feel it seems can work, and will try it.
but I don't know how this change in qemu's QIOChannel code
will affect the other code. needs other people confirm it?
If no affect and works good,I will send a independent patch
for this.

Zhang Chen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]