def bar(): barc = 0 while barc < 25: log.info("I'm bar %d", barc) barc += 1 yield yield asyncio.KillOs()
def wait3(): yield while True: result = yield asyncio.Wait4Signal("Hello") log.info("Task wait3() got signal value:") print(result) if result[1] == 10: yield asyncio.KillOs()
def led3(): total = 0 while True: neo.toggleR(3, 80) neo.writeBuffer() total += 1 yield log.info("Total of task led3 now: %d" % total) if total > 10: yield asyncio.KillOs()
def master_of_universe(): yield log.info("Creating task led0. Red led goes flashing fast!") tid = yield asyncio.CreateTask(led0(), period=100, prio=11) log.info("Kill task led0 with tid %d. Red led stops flashing!", tid) yield asyncio.KillTask(tid) log.info("Kill the os itself!") yield asyncio.KillOs() log.info("Task master_of_universe is ready!")
def ledR(): log.info("Starting ledR") total = 0 yield while True: total += 1 neo.toggleR(1, 80) neo.writeBuffer() yield if total > 120: log.info("Shut down server!") server.shutdown() yield asyncio.KillOs()
def evaluate(total): yield log.info("Start to evaluate...") starttime = time.ticks_ms() yield endtime = time.ticks_ms() t = total[0] us = endtime - starttime text = "c/s: %f " % (t / 10) log.info("Total millis in 10 second runtime: %f", us / 1000) log.info("Total counts: %d counts /sec: %f ", t, t / 10) yield asyncio.KillOs()
def wait4task0(tid0): yield result = yield asyncio.WaitTask(tid0) log.info("wait4task0: Waiting for task %d to end.Did I wait? : %s",tid0 ,result) yield asyncio.KillOs()
def kill(): yield https.shutdown() yield asyncio.KillOs()
def kill(): yield log.info("Shut down server!") yield asyncio.KillOs()
def kill(): yield yield asyncio.KillOs()