WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Parallel Threads (https://forum.worldviz.com/showthread.php?t=560)

Hodge1620 04-24-2006 11:06 AM

Parallel Threads
 
Hi - I have some substantial processing that needs to happen within a continuous timer, and I am trying to split the processing into multiple threads that can run in parallel. (My alternative is to stick with my current framerate of 5 frames per second.) However, it seems that any command using the 'thread' module causes vizard to crash, burn, and run away screaming. For example, the following script runs perfectly well in pythonwin, but when run in Vizard, it asks me to send an error report to Microsoft....

import thread

def sayHello(id):
print "Hello from thread", id

for i in range(5):
thread.start_new_thread(sayHello, (i,))



Is this a unique problem to Vizard 2.1 (which I am using to debug)? Do I need to do something special to prevent the crash? Alternatively, (by reading in-between the lines of your documentation) it seems that the viz.director() function might allow for seperate threads. Is this a correct assessment, or is there some other way to handle threading?


Thanks,
-Eric

farshizzo 04-24-2006 11:32 AM

Hi,

Yes, this is a known problem in version 2.X which has been resolved in 3.0. In the meantime you can use director functions. It's basically a wrapper around threading.

However, I'm not sure how much threading will help speed up your script. Dropping down to 5 fps is pretty significant, you might want to consider converting your computation code into a python C module. There should be an example of this on the download page. I can also help you get started if you wish to go this route.


All times are GMT -7. The time now is 01:30 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC