Re: Quitting a child thread's GMainLoop
- From: Tony Cebzanov <tonycpsu gmail com>
- To: Chris Vine <chris cvine freeserve co uk>
- Cc: gtk-list gnome org
- Subject: Re: Quitting a child thread's GMainLoop
- Date: Wed, 04 Aug 2010 18:39:47 -0400
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?
It just seems wasteful to have a "source" whose only purpose is to tell
the thread to quit. I know it's theoretically being called at an "idle"
priority, but it's still using resources just to check whether it's time
to shutdown or not. I was hoping for some mechanism where the main
thread would notify the child thread GMainLoops that it's time for them
to quit. Each thread having to check the flag constantly just doesn't
seem very clean to me, but if it's the only way to do it, I'll settle. :/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]