Re: main loop, threads and so on?



Am 2003.06.07 21:27 schrieb(en) Ian Bell:
On Saturday 07 Jun 2003 5:21 pm, Martin Klaffenboeck wrote:
> 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.
>

Probably the most elegant way to do this is to run the function in its
own
thread.

I'll try that.  What do I have to do?

I thought about the following:

int main (argc argv)

gdk_threads_init();

gdk_threads_enter ();
gtk_main();
gdk_threads_leave ();

and in my thread using always gdk_threads_enter and ..._leave for every gtk_treestore_append ..._set functions.

When I use gdk_threads, what is important here. Do I have to lock every gtk_function ?

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



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