def METHOD_NAME(executor_reference, work_queue):
    try:
        while True:
            work_item = work_queue.get(block=True)[-1]
            if work_item is not None:
                work_item.run()
                del work_item
                continue
            executor = executor_reference()
            if _SHUTDOWN or executor is None or executor._shutdown:
                work_queue.put(NULL_ENTRY)
                return None
            del executor
    except BaseException:
        _base.LOGGER.critical("Exception in worker", exc_info=True)