WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 10-19-2004, 04:25 PM
tavaksai tavaksai is offline
Member
 
Join Date: Jul 2004
Posts: 22
running into a thread limit

Hi guys,

I found a problem having to do with threads. I am not sure if this is a bug or if I am doing something wrong.

Basically, after executing a certain number of threads or calling functions that use threads (I am guessing Vizard's <multimedia>.play() uses a thread and I know viz.director() starts a thread), Vizard refuses to create or run any more threads. I load many multimedia files into my application (a dozen .avi and a dozen .wav) and I think that may be the cause. After certain number of calls <multimedia>.play() seems to generate the following error:
FAILED (hr=0x80007000e) in pMC->Run()
Also, if I load two dozen multimedia files and then start creating threads using python's thread library ( example: thread.start_new_thread(Animate, ()) ), eventually I get an error that says something like, "Failed to create thread" even if I don't call <multimedia>.play() at all.

Is this a bug in Vizard?

Max
Reply With Quote
  #2  
Old 10-20-2004, 10:57 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

I'm going to test this out here. How many times do you run a director function? When you hit the thread limit, are you not able to run director functions also? Is the thread limit consistent (i.e. does it always stop working when you create a certain amount of media objects)?
Reply With Quote
  #3  
Old 10-20-2004, 11:49 AM
tavaksai tavaksai is offline
Member
 
Join Date: Jul 2004
Posts: 22
threads

Hi Farshizzo,

Yes, viz.director() stops also even without a single execution of <multimedia>.play() and <multimedia>.play() eventually stops working without any viz.director() calls.

Try running the following code:

import thread
import time
import viz
viz.go()

def myfunc():
sum = 0
for i in range(100000):
sum = sum + i
print 'sum is:', sum

for i in range(100):
thread.start_new_thread(myfunc, ())

On my computer, which by the way has plenty of memory, I only get 47 outputs of "sum is 4999950000" even though I create 100 threads and I get a message in red that says, "error: can't start new thread". You can replace the last line above with viz.director(myfunc) and you will get the same result except that no error message will be displayed.

Max
Reply With Quote
  #4  
Old 10-20-2004, 12:53 PM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Hi,

Thanks for the code sample, I also get an error here at thread 47. I've made a change to Vizard and now the sample works fine, even with director functions. However, I haven't tested it with media files. If you just add 30 media files and try to play them all, do you get an error?
Reply With Quote
  #5  
Old 10-27-2004, 03:59 PM
tavaksai tavaksai is offline
Member
 
Join Date: Jul 2004
Posts: 22
Thanks for fixing the problem. Both the threads and multimedia files work fine now.
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 07:30 AM.


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