Re: gtk2 multithreaded programming win32 issue



On Thu, Aug 28, 2008 at 5:23 PM,  <jcupitt gmail com> wrote:
> Hi,
>
> 2008/8/28 Kuang-Chun Cheng <kcc1967 gmail com>:
>> 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.
>
> You don't need the GAsyncQueue. Just call g_idle_add() from the
> non-gui thread and the idle callback will run in the gui thread next
> time the main loop is idle. I do this in my app and it works well on
> linux and windows.
Hi John,

Could you explain more on this ?  Is calling g_idle_add() from
"NON-GUI" thread important ?   I think no matter which thread invoke
g_idle_add(),
the idle callback will be associated with default main loop, am I correct ?

Did you put a g_usleep() in your idle callback ?  If not, how did you avoid
the idle callback to take all of the CPU loading ?

Thanks
KC



>
> John
>


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