Quitting a child thread's GMainLoop

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

 



I'm developing a multi-threaded GLib application.  Each thread,
including the main thread, has its own GMainLoop for polling input sources.

This works well, but I'm having trouble finding an elegant way to
shutdown the child threads from the main thread, because the "main
loops" I want to quit live in the child threads.  Is there any way I can
quit the main loop of a child thread from a parent thread?  Can a parent
thread somehow access the "main loop context" of a child thread and tell
it to quit somehow?

I know I can pass in data (such as the address of a gboolean "shutdown"
variable) to the g_thread_create call(), but how does the child thread
check this flag when running in a GMainLoop?  It seems a bit silly and
wasteful to create an idle GSource just to check a quit flag -- but is
that the only way to do it?

Thanks.
-Tony

_______________________________________________
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