Re: Quitting a child thread's GMainLoop

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

 



On Wed, 04 Aug 2010 18:39:47 -0400
Tony Cebzanov <tonycpsu@xxxxxxxxx> wrote:

> 
> On 8/4/10 6:33 PM, Chris Vine wrote:
> > I have probably not understood what you are trying to do, but if all
> > the threads have their own main loops why not have the main thread
> > pass an idle callback to the thread(s) you want to end which calls
> > g_main_loop_quit()/gtk_main_quit()? If you have called
> > g_thread_init() then the main loops will all be thread safe.
> 
> That sounds like it would work, but wouldn't each thread then be
> calling the "check the quit flag" callback function constantly?

Our posts have crossed but you wouldn't use a quit flag at all.  If the
main thread calls g_main_loop_quit() on a worker thread's main loop,
whether via an idle handler (my first suggestion) or directly (my
second), the main loop will come to an end and the thread will run to
its return point and terminate.

Chris
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux