我想运行以下代码。 该代码应运行最大数量的线程。 该代码可以正常工作,但是每当您达到最大线程数时,该代码会在代码继续出现之前打印出我在下面指定的错误。
有人知道如何防止Thread()打印错误吗?
x = 0
while 1:
try:
t = Thread(target=learn, args=(line,)) #writer,))
thread_list.append(t)
t.start()
break
except Exception as exp:
time.sleep(1)
if x == 0:
print "Waiting for free thread",
x = 1
else:
print ".",
File "C:\Python27\lib\threading.py", line 736, in start
_start_new_thread(self.__bootstrap, ())
error: can't start new thread
Continues to run ....