Re: main loop, threads and so on?



Am 2003.06.07 18:21 schrieb(en) Martin Klaffenboeck:
Hello,

Where can I find a good manual, tutorial to understand how the mainloop is working, what all the things of http://developer.gnome.org/doc/API/2.0/glib/glib-The-Main-Event-Loop.html are doing?

How I can work with that.

In my special case I have a function which has nothing todo with the gui to call, but the function calling that function must wait until it is finished. It takes long time, so the gui is not responsible for the user. so my function (which is calling the function) has to run in the backgound.


i.e.

void fill_treemodel ()
{
  <definitions>

  result = function_takes_long_and_has_nothing_todo_with_the_gui
(...);

  while(....result....)
  {
    gtk_treestore_append(..)
    gtk_treestore_set(..)
    while (gtk_events_pending()) gtk_main_iteration();
  }
}

Now I have to call fill_treemodel(). When this function gets to ); my gui stands still while the function works (sometimes 2 minutes, but it could also be 30 minutes and more) and I'm not able to use the app and also it seems that also gnome stands still, the gnomepanel is not usable and also no other windows can get focus to do anything. The only way is to switch to the Konsole and kill my app, when I don't wan't to have coffee while my programm works.

So what can I do to make the gui working (for user inputs) while function_takes_long_and_has_nothing_todo_with_the_gui(...) runns?

And what I've forgotten to say: the function fill_treemodel () should be stopable, even if function_takes_long_and_has_nothing_todo_with_the_gui(...) is running at the moment. (Is it possible to kill a function like we can kill a prozess with kill PID).

Thanks for hints,
Martin

--
If you've got an idea and need help,    ICQ: 72997139
or just need general encouragement,     MSN: kleinerdrache gmx at
write me a message. ;-) Yahoo-Messenger: walking2martin
                                        AIM: littlewizzard
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


--
If you've got an idea and need help,    ICQ: 72997139
or just need general encouragement,     MSN: kleinerdrache gmx at
write me a message. ;-)                 Yahoo-Messenger: walking2martin
                                        AIM: littlewizzard



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