def METHOD_NAME(self, wait=True):
    with self._shutdown_lock:
        self._shutdown = True
        # Empty the entire work queue: (mod. from py39's added option 'cancel_futures')
        while True:
            try:
                work_item = self._work_queue.get_nowait()[-1]
            except Empty:
                break
            if work_item is not None:
                work_item.future.cancel()
        # Send a wake-up to prevent threads calling _work_queue.get(block=True) from permanently blocking
        self._work_queue.put(NULL_ENTRY)
    if wait:
        for thread in self._threads:
            thread.join()