Armin Bauer wrote:
Hi everyone,
i am experiencing random problems here if i use g_main_loop_quit from a
different thread than where the GMainLoop runs.
my program looks like this:
1. in main: create a new context and a new loop
2. spawn a thread
3. call g_main_loop_run in the thread on the previously created loop
4. some time later: call g_main_loop_quit from main
whats supposed to happen (i guess) is that the main loop quits. But
sometimes the call to loop_quit just has not effect, so the main loop
continues to run.
Is this a known problem or am i doing something wrong?
My guess is that it just doent make sence to remove the mainloop
while the other thread is sleeping in poll(), sure the code will lock
its mutex and everything; but when the other thread wakes up;
how could it deal with a "gone mainloop" ?
Solution ? I would use an idle function to the thread's loop; using
the GSource lower level apis (i.e. create the idle source and do
g_source_attach to the thread's context); and just quit from
there.
Cheers,
-Tristan
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list