Hi assuming my application runs in two threads: one for the soya stuff and the other to steer the first thread -- how to do I stop the soya-mainloop running in the first thread from the second thread?
I've currently two solutions: Solution 1: Thread2 sets a shared variable which is checked in Thread1 (eg in a begin_round) If Thread1 detects, that this variable is set, it calls soya.MAIN_LOOP.stop() Problem: It takes a while (sometimes minutes) until the main-loop quits. I suppose the problem is, that Thread1 which runs the mainloop eats up all the CPU cycles and it just takes some random amount of time until Thread2 can actually set the variable. Solution 2: Instead of running the mainloop in Thread1, I just call the update method repeatedly: while not stopping: time.sleep(0.025) # 40 FPS my_mainloop.upate() the sleep call assures that Thread2 doesn't starve. Setting "stopping" in Thread2 has immediate effect on Thread1. Problem: due the sleep call (no matter how small the value is -- even 0) causes the rendered output to judder -- it looks like 4 FPS not 40. What would be your solution to stop the soya-thread from a second one, without losing performance in the rendering? Cheers, Bastian -- Bastian Venthur http://venthur.de Debian Developer venthur at debian org _______________________________________________ Soya-user mailing list Soya-user@gna.org https://mail.gna.org/listinfo/soya-user