'Shutdown the queue (after finishing any pending requests).'

def shutdown(self, force_quit_timeout=0):

    self.logger.info('Shutting    down    threadpool')
    for i in range(len(self.workers)):
        self.queue.put(ThreadPool.SHUTDOWN)
    hung_workers = []
    for worker in self.workers:
        worker.join(0.5)
        if worker.isAlive():
            hung_workers.append(worker)
    zombies = []
    for thread_id in self.dying_threads:
        if self.thread_exists(thread_id):
            zombies.append(thread_id)
    if (hung_workers or zombies):
        self.logger.info("%s    workers    didn't    stop    properly,    and    %s    zombies", len(hung_workers), len(zombies))
        if hung_workers:
            for worker in hung_workers:
                self.kill_worker(worker.thread_id)
            self.logger.info('Workers    killed    forcefully')
        if force_quit_timeout:
            timed_out = False
            need_force_quit = bool(zombies)
            for worker in self.workers:
                if ((not timed_out) and worker.isAlive()):
                    timed_out = True
                    worker.join(force_quit_timeout)
                if worker.isAlive():
                    print(("Worker    %s    won't    die" % worker))
                    need_force_quit = True
            if need_force_quit:
                import atexit
                for callback in list(atexit._exithandlers):
                    func = getattr(callback[0], 'im_func', None)
                    if (not func):
                        continue
                    globs = getattr(func, 'func_globals', {})
                    mod = globs.get('__name__')
                    if (mod == 'threading'):
                        atexit._exithandlers.remove(callback)
                atexit._run_exitfuncs()
                print('Forcefully    exiting    process')
                os._exit(3)
            else:
                self.logger.info('All    workers    eventually    killed')
    else:
        self.logger.info('All    workers    stopped')
