[Techtalk] Re: More questions about C and GTK+ stuff

Michelle Konzack linux4michelle at freenet.de
Wed May 16 14:44:30 UTC 2007


Hello Wolfgang,

An example HOW it works:

----8<------------------------------------------------------------------
main() {
  pthread_t tids[10];

  while ( TRUE )
  {
    while ( gtk_events_pending() )
    gtk_main_iteration();

    pthread_create(tids + 1,
                   NULL,
                   my_cool_func,
                   (void *)(param));

    <some_code_to_update_the_dialog>
  }
}

void my_cool_func(void *param) {
  ...
  <get the data from server>
  ...
  return 0;
}
----8<------------------------------------------------------------------

I have copied only one example into my sourcecode and it was just
working...  I have put all over the sourcecode something like
printf("fnc X : stamp X") and while I was in the Gtk+ GUI, the
pthread was running...

Now I have to find out, how I can put the collected data fro,
my_cool_func() back into the GtkTreeView widget...

Now I do not know, whether I must put the Gtk-Update-code into the
my_cool_func() or after tis one in <some_code_to_update_the_dialog>.

Oh, yes, the phread_create() must be self-locking since it should
run only one instance of it...  otherwise you will kill your server
with milions*milions*milions requests  :-/

I have already crashed my courier-imap...  (an experience :-/  )

Greetings
    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)


More information about the Techtalk mailing list