B
BaoYongjun
Hi,all:
Could someone explan the python thread to me?
When I use the python thread,I find some problems.If I run many
(such as 100) python threads ,then all thread are blocked.Below is the code:
import thread,time
def f():
print 'f()'
def loop():
while True:
f()
for i in xrange(100):
t=threading.Thread(target=loop)
t.start()
time.sleep(100000000)
I run this program on red hat linux.The intersting thing is that
the program sometimes works,but somtimes blocks(no output at all).
Could someone explan the python thread to me?
When I use the python thread,I find some problems.If I run many
(such as 100) python threads ,then all thread are blocked.Below is the code:
import thread,time
def f():
print 'f()'
def loop():
while True:
f()
for i in xrange(100):
t=threading.Thread(target=loop)
t.start()
time.sleep(100000000)
I run this program on red hat linux.The intersting thing is that
the program sometimes works,but somtimes blocks(no output at all).