Re: Quitting a child thread's GMainLoop
- From: Chris Vine <chris cvine freeserve co uk>
- To: Tony Cebzanov <tonycpsu gmail com>
- Cc: gtk-list gnome org
- Subject: Re: Quitting a child thread's GMainLoop
- Date: Wed, 4 Aug 2010 23:44:05 +0100
On Wed, 04 Aug 2010 18:39:47 -0400
Tony Cebzanov <tonycpsu gmail com> 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]