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);
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:
guint
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?