lib/task/pool.py
def shutdown(self, wait=True, timeout=None):
        '''
        Posts a quit message to all running workers.

        If `wait` is truthy, then this call will also block until all worker
        threads have returned. Otherwise, this method will return immediately
        after posting the quit message (`timeout` will be ignored).

        If `timeout` is given along with `wait`, this call will block for a
        maximum of `timeout` seconds for each worker to join. Otherwise, this
        will block indefinitely while waiting for the threads to stop.

        The `timeout` parameter is shared between all join operations. It is
        possible for this function to block for longer than `timeout` seconds
        (i.e. up to a maximum of `num_workers` * `timeout` seconds).
        '''
        with self._lock:
            self._running = False
            self._queue.put(None)

        wait_result = True
        if wait:
            # create a copy of the worker set, as we'll be removing workers
            # once they get joined successfully
            workers = list(self._workers)

            for worker in workers:  # type: Worker
                try:
                    worker.join(timeout=timeout)
                except TimeoutError:
                    # update overall result to indicate failure
                    wait_result = False
                else:
                    # remove worker from worker set
                    self._workers.remove(worker)

        return wait_result

        Posts a quit message to all running workers.

        If `wait` is truthy, then this call will also block until all worker
        threads have returned. Otherwise, this method will return immediately
        after posting the quit message (`timeout` will be ignored).

        If `timeout` is given along with `wait`, this call will block for a
        maximum of `timeout` seconds for each worker to join. Otherwise, this
        will block indefinitely while waiting for the threads to stop.

        The `timeout` parameter is shared between all join operations. It is
        possible for this function to block for longer than `timeout` seconds
        (i.e. up to a maximum of `num_workers` * `timeout` seconds).
        
Posts a quit message to all running workers.
If `wait` is truthy, then this call will also block until all worker
threads have returned. Otherwise, this method will return immediately
after posting the quit message (`timeout` will be ignored).



The `timeout` parameter is shared between all join operations. It is
possible for this function to block for longer than `timeout` seconds
.
Posts a quit message to all running workers . If ` wait ` is truthy then this call will also block until all worker threads have returned . Otherwise this method will return immediately after posting the quit message ( ` timeout ` will be ignored ) . The ` timeout ` parameter is shared between all join operations . It is possible for this function to block for longer than ` timeout ` seconds .
def shutdown(self, wait=True, timeout=None):
        with self._lock:
            self._running = False
            self._queue.put(None)
        wait_result = True
        if wait:
            workers = list(self._workers)
            for worker in workers:  
                try:
                    worker.join(timeout=timeout)
                except TimeoutError:
                    wait_result = False
                else:
                    self._workers.remove(worker)
        return wait_result
def shutdown ( self , wait = True , timeout = None ) : with self . _lock : self . _running = False self . _queue . put ( None ) wait_result = True if wait : workers = list ( self . _workers ) for worker in workers : try : worker . join ( timeout = timeout ) except TimeoutError : wait_result = False else : self . _workers . remove ( worker ) return wait_result
Posts a quit message to all running workers.
Posts a quit message to all running workers .
'''
        Posts a quit message to all running workers.

        If `wait` is truthy, then this call will also block until all worker
        threads have returned. Otherwise, this method will return immediately
        after posting the quit message (`timeout` will be ignored).

        If `timeout` is given along with `wait`, this call will block for a
        maximum of `timeout` seconds for each worker to join. Otherwise, this
        will block indefinitely while waiting for the threads to stop.

        The `timeout` parameter is shared between all join operations. It is
        possible for this function to block for longer than `timeout` seconds
        (i.e. up to a maximum of `num_workers` * `timeout` seconds).
        ''' # create a copy of the worker set, as we'll be removing workers # once they get joined successfully # type: Worker # update overall result to indicate failure # remove worker from worker set
self
wait
timeout