When I read some code,I think the usage of Event is not necessary,is it right?
# start server while True: # accept a request here queue.put(info) event.set() # notify all the threads? # pass queue and event here to a Thread constructor
other place there are more than 10 threads running,
# inside a Thread class def __init__(self, queue, event): threading.Thread.__init__(self) self.queue, self.event = queue, event def run(self): while True: self.event.wait() # <- block here, I think this can be removed info = self.queue.get() # <- block here again, only one thread can get job to do? # do something self.queue.task_done() self.event.clear() #