17 lines
531 B
Python
17 lines
531 B
Python
import aiosched
|
|
from raw_wait import child
|
|
|
|
|
|
async def main(children: list[tuple[str, int]]):
|
|
print("[main] Spawning children")
|
|
async with aiosched.with_context() as ctx:
|
|
for name, delay in children:
|
|
await ctx.spawn(child, name, delay)
|
|
print("[main] Children spawned")
|
|
before = aiosched.clock()
|
|
print(f"[main] Children exited in {aiosched.clock() - before:.2f} seconds")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
aiosched.run(main, [("first", 1), ("second", 2), ("third", 3)], debugger=None)
|