[help]problem with python thread

BaoYongjun byj at net.pku.edu.cn
Sat Oct 29 09:20:22 EDT 2005


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). 




More information about the Python-list mailing list