def create_task(coro): if not hasattr(coro, "send"): raise TypeError("coroutine expected") t = Task(coro, globals()) _task_queue.push_head(t) return t
def run_forever(): global _stop_task _stop_task = Task(_stopper(), globals()) run_until_complete(_stop_task)
def run_forever(run_once=False): global _stop_task _stop_task = Task(_stopper(), globals()) run_until_complete(_stop_task, run_once=run_once)