response = [['[common]'], ['[webui]'], ['[webui]', '[debug]', 'msgq']]
def checkline(self,each_response, line, queue ):
if all(w in line for w in each_response):
queue.put(True)
else:
queue.put(False)
with open(debugfile, "r") as in_file:
if bool(response):
threads = []
final = []
for i_response in range(len(response)):
queued_request = Queue.Queue()
t = threading.Thread(target=self.checkline, args(response[i_response],line.lower(),queued_request,))
threads.append(t)
t.start()
final.append(queued_request.get())
for x in threads:
x.join()
print final
if True in final:
print line
这里我希望同时启动所有线程以减少执行时间。 请提出任何建议吗?