Don't know anything about python but in general you should pass the loop
variable to the calling thread (your main function) and then loop.quit()
from there when you are done.
To pass the loop variable you have basically two options:
- the easy way: initialize
loop
withgobject.MainLoop()
before forking, so it is available from both threads; - the hard way: pass the value to the main thread after having initialized it in the loop thread.
An example (in C) of passing data between threads is shown by the GCond documentation (push_data()
and pop_data()
).