[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Gtk+ and multithreating
- From: Chris Vine <chris cvine freeserve co uk>
- To: Michelle Konzack <linux4michelle freenet de>
- Cc: GTK Application Developers List <gtk-app-devel-list gnome org>
- Subject: Re: Gtk+ and multithreating
- Date: Mon, 14 May 2007 22:22:34 +0100
On Mon, 2007-05-14 at 19:53 +0200, Michelle Konzack wrote:
> Hello *,
>
> I am new on this list, but have already codes some VERY simple admin
> GUI's... Now I have a bigger problem/Application which need definitiv
> multithreading since it must poll several servers and update several
> TreeView and ListView. I have no experience with it, since I am one
> of those
>
> console-singel-task-no-one-bother-me
>
> programmers (Debian GNU/Linux)... :-)
>
> OK, for now my GUI is running and then I use a loop like
>
> ----8<--------------------------------------------
> window_main=create_window_main();
>
> while ( TRUE )
> {
> while ( gtk_events_pending() )
> gtk_main_iteration();
>
> <some_code_to_update_the_dialog>
> }
> ----8<--------------------------------------------
>
> where <some_code_to_update_the_dialog> are several functions which are
> executed one after one. Problem FOR NOW is that each function need
> ages to get the data and my GUI is dead while running the functions...
Pass the callbacks representing the events concerned to the main program
loop using g_idle_add(). Make sure the callbacks return FALSE.
g_idle_add() is thread safe, provided that you have initialised glib
with g_thread_init().
Chris
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]