def __init__(self): self.tasks_by_path = {} self.queued_tasks = [] self.semaphore = threading.Semaphore(0) self._lock = threading.Lock()