On 14/05/2014 at 01:39, xxxxxxxx wrote:
I´ve never used threads before and I´m not sure if I understand this right.
If I open a new thread in c4d, is it only a user thread and not a Kernel thread?
Does that mean that I'm only working on one Kernel and I just delegate tasks to several User threads?
And is this the right usage, cause within the function it says that I´m still using the Main thread?
import c4d
from c4d.threading import C4DThread
class firstThread(c4d.threading.C4DThread) :
k=0
def func1(self,k) :
print c4d.threading.GeIsMainThread(),"main"
for i in xrange(1,8000) :
x=1000000/i
for j in xrange(1,1000) :
y=1000000/j
k=x*y
print c.IsRunning(),"first inside"
return k
class secondThread(c4d.threading.C4DThread) :
o=0
def func2(self,o) :
print c4d.threading.GeIsMainThread(),"main"
for i in xrange(1,8000) :
x=1000000/i
for j in xrange(1,1000) :
y=1000000/j
o=x*y
return o
c= firstThread()
d= secondThread()
#Start Threads
c.Start()
k= 0
print c.IsRunning(),"first"
k= c.func1(op)
d.Start()
o= 0
print d.IsRunning(),"second"
o= d.func2(op)
c.End()
d.End()
print o+k
Martin