WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-24-2006, 11:06 AM
Hodge1620 Hodge1620 is offline
Member
 
Join Date: Aug 2005
Posts: 12
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
__________________
Eric Hodgson
Miami University: SpaceLab
Reply With Quote
  #2  
Old 04-24-2006, 11:32 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
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.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:49 AM.


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