Bastian Venthur schrieb:
> 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.

Actually this solution works pretty well, I had a bug in my code which
stopped the mainloop only if there was something in soya's event queue.

My problem seems to be solved with solution 1, but let me know if you
have a better idea.


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

Reply via email to