Willi Richert wrote: > Hi, > > I have a simulation application (PlayerStage) in which the robot is asked > every ~200ms for an action. In the meantime the robot has to do some > calculation with the perception. As the calculation gets more and more time > consuming I am thinking about outsourcing it into a concurrently running > method. If the calculation takes too long it would be ok for the result to be > incorporated in some future cycle of the main loop, resulting in the > calculation being done less and less often and the main loop executing some > stop behavior. > My question: Is there a possibility in Python (either with the threading > module or with Twisted's non-threading style) to prioritize the two > (pseudo-)concurrent methods so that the main tread is further on executed > every ~200ms and the calculation thread being executed only in "idle" time > slots? > > Thanks, > wr
Hi, I suggest taking a look a PEP 342 http://www.python.org/dev/peps/pep-0342/. The new coroutines capability in Python 2.5 seems to be intended for exactly what you are doing. -- Doug Fort, Consulting Programmer http://www.dougfort.com -- http://mail.python.org/mailman/listinfo/python-list