<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wait_all_tasks_done(self, timeout=None, delay=0.5, interval=0.1):
 """Block, only be used while loop running in a single non-main thread."""

        timeout = self._timeout if timeout is None else timeout
        timeout = timeout or float("inf")
        start_time = time.time()
        time.sleep(delay)
        while 1:
            if not self.todo_tasks:
                return self.all_tasks
            if time.time() - start_time > timeout:
                return self.done_tasks
            time.sleep(interval)