Re: gtk2 multithreaded programming win32 issue
- From: "Kuang-Chun Cheng" <kcc1967 gmail com>
- To: "Tor Lillqvist" <tml iki fi>
- Cc: gtk-list <gtk-list gnome org>
- Subject: Re: gtk2 multithreaded programming win32 issue
- Date: Thu, 28 Aug 2008 17:05:21 +0800
On Thu, Aug 28, 2008 at 3:42 AM, Tor Lillqvist <tml iki fi> wrote:
>> Are these correct ?
>
> Yes,
OK, thanks.
Here is my another question.
My GUI require update after some non-gui thread finish it's task.
So I create an idle callback + GAsyncQueue in main thread.
When non-gui thread push message to GAsyncQueue, my idle callback will
be wakeup and do the GUI update.
And I found when idle callback block on GAsyncQueue, the GUI is locked !!
or the main event loop is blocked.
I then replace the g_async_queue_pop() by g_asysc_queue_try_pop(), it works but
take 100%CPU load.
Use g_async_queue_timed_pop() help ... but the GUI become polling driven instead
of event driven ... which I don't like.
Also replace idle callback by timeout callback works fine too, but again, it's
not event driven.
I also look into GObject system, impl. an object signal which will do
the GUI call.
Emit the signal from non-gui thread ... but this doesn't work. The callback
function connect to the object will be run in non-gui thread instead
of main thread.
Is it possible for a GObject to connect to a callback which will be
invoke by thread A
when receive signal from thread B ?
Well, so far, I tried couple methods ... and only polling driven approach work.
Is this the only way to use Gtk2 under Win32. Any better approach
(event driven)
which allow to update GUI by receiving trigger/signal from non-gui thread ?
Thanks a lot
Regards
KC
>
> --tml
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]