def __init__(self, nthreads, waiting_fifo): super(QueueManagerThread, self).__init__() self.daemon = True self.running_fifo = fifo(nthreads) self.waiting_fifo = waiting_fifo self.workers = [] for num in xrange(nthreads): self.workers.append(QueueWorkerThread(self.running_fifo, num))
def __init__(self, nthreads, *computations): self.lock = threading.Lock() self.waiting = fifo() self.counter = 0 self.nthreads = nthreads self.computations = [] self._started = False for c in computations: self.enqueue(c)