Re: gtk_main_quit from another thread



On Sat, 12 Feb 2005 15:57:59 +0500, Zeeshan Ali <zeenix gmail com> wrote:
Hello,
    What is the correct/nice way of asking a thread to stop from the
main thread if that thread is in a gtk_main (). I simply call
gtk_main_quit () from my main thread and then wait for that thread to
actually finish calling g_thread_join (). I've a hunch that there is
something wrong with this technique. Am i right? Thanks in advance.
Bye.

If you need to transfer alot of different requests etc, you can implement
an IPC for your threads using a GAsyncQueue (or something else), 
otherwise you could just use a global variable (possibly protected by
a mutex) to notify your child thread that it should exit.

So generaly you would start by requesting termination of your child thread
and then g_thread_join() (you might also `kill()' your child thread if
it doesn't
exit in time).

Cheers,
                                                      -Tristan



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