def run(r=None): if w.total > 1000: reactor.stop() return w.total += 1 df = launch_coroutine(wrap_task(reactor.callLater), w.do_some_things) df.addCallback(run) df.addErrback(set_event_error)
def run_task_and_exit(): #for i in xrange(1000): for i in xrange(100040): w.total += 1 df = launch_coroutine(wrap_task(reactor.callLater), w.do_some_things) df.addCallback(set_event) df.addErrback(set_event_error)