Re: Multithreaded gtk apps
- From: jcupitt gmail com
- Cc: ML-gtk <gtk-list gnome org>
- Subject: Re: Multithreaded gtk apps
- Date: Mon, 14 Jan 2013 12:02:20 +0000
On 14 January 2013 04:46, Andy Spencer <andy753421 gmail com> wrote:
> run on win32. I would caution against overuse of g_idle_add though.
>
> Recently I've been saving off the data from the thread and then doing
> the GUI updates at the start of the next expose/draw.
I generally do both. I like:
* a background thread finishes some task and calls g_idle_add_full()
with high priority to send the result to the main thread
* the main thread runs the idle callback and uses the data to update
the program model
* the program model queues a view refresh for every part of the model
that changes with a low priority g_idle_add_full()
* the views update from the model and (eventually) turn into an expose/draw
The idea is to decouple model updates from drawing, so under load your
program just updates the display less frequently, it never drops data
or lags.
Different structures will suit different programs, of course.
John
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]