i am trying an approach of multithreading, like this:
def myThread(): global myThreadRunning; doHeavyCalculations(); myThreadRunning=0
def myOnlyTask(task):
global myThreadRunning
while myThreadRunning: time.sleep(0.005)
updatePandaNodesForRendering()
myThreadRunning=1; thread.start_new_thread(myThread,()); return task.cont
taskMgr.add(myOnlyTask,'myTask')
my questions are:
- does this approach make Panda routines and “doHeavyCalculations” parallel? assuming my CPU has 4 cores.
- in “doHeavyCalculations”, can i call Panda functions such as collision.traverse, Vec3.angleRad , or create new Vec3 instance ?
PS: the threading-model from Panda doesn’t always work in my apps, so i try this.