Threading in c4d

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/04/2011 at 06:12, xxxxxxxx wrote:

Hi.

It seems like threading does not work in cinema 4d. Is this right or am I doing something wrong ?
Cinema 4D still stops doing anything until the thread has finished.

  
from threading import Thread  
from time import sleep  
  
class mythread(Thread) :  
  def __init__(self) :  
      Thread.__init__(self)  
  
  def run(self) :  
      print "started"  
      sleep(10)  
      print "finished"  
  
t = mythread()  
t.start(); t.join()  

for scriptmanager

Calling a Process from the multiprocessing module does even raise an error.

Thanks, nux

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 27/04/2011 at 12:35, xxxxxxxx wrote:

The script manager executes the Python script in the main thread.
That means it sure blocks C4D until t.join() returns.You can use
one or more custom threads in scripts but they all need to be finished
at the end of the script. Threads in Plugins do offer more advantages here.