AW: Gtk+ and multithreating



Hi list,...

...im sorry if i missunderstand something...

Am 14.05.2007 19:53:44 schrieb(en) Michelle Konzack:
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<--------------------------------------------


...could it be two threads try updating the same GUI-Structure !? - trying to resolve their reflections of their updates on the Object-Tree or something that way??

Maybe the simplest way is to code the main thread first, and (ok, here im in pain) then, following new threads, lock that functions changing something GUI-pending for thread-safety; i had already such a Prog, but cannot remember.

Was that something with g_mutex_lock !? Threre was a tutorial...anywhere.

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...

If there is nothing to do, the CPU load is 100% while running the
loop.
Oops!

Not realy what I want!

So, can anyone provide me with a Tutorial HOW TO MULTITHREAD those
functions <some_code_to_update_the_dialog> ?

Ok, im still here...hope i understand...u get in to the update function...and update some widgets!?? - or what...

...or it just takes to much time to calculate the data, and for that time your (main-)thread cannot update the gui.

Then it should work as i said...

-signal to update data starts 2nd thread
-main thread does normal gui response
-2nd thread got data
-2nd thread comes into situation to have to lock (thats that thing i have "had" a link for) some gui-data so main thread does not conflict with
or
-me is false and i am just to happy with talking to myself ;)


And maybe some other tips...

Thanks, Greetings and nice Day
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


--
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant
#####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSN LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)


_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list






___________________________________________________________
Der frühe Vogel fängt den Wurm. Hier gelangen Sie zum neuen Yahoo! Mail: http://mail.yahoo.de



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