Re: problems when using g_main_loop_quit from different thread



Tristan Van Berkom wrote:

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" ?

Scratch that; doesnt make any sence; the code also seems to have
thread conditional stuff; so it should work - I guess.

... Maybe it fails in the off chance that its not in poll() ? still should work ...

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.

I still bet this will work (unless you are running a rare gtk binary
that was compiled without thread support; and that should have
been indicated when you called g_thread_supported()).

Cheers,
                               -Tristan




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