adafruit / Adafruit_CircuitPython_asyncio

CIrcuitPython subset of CPython asyncio library
MIT License
28 stars 16 forks source link

feat: support `wait` as a function #56

Closed imnotjames closed 1 year ago

imnotjames commented 1 year ago

This adds support for wait from asyncio in CPython. wait is helpful because it allows for specifying the return_when behavior - so you can run multiple async and get a value back when the first succeeds or raises, or when all have completed. It also makes the timeout an optional behavior.

In an attempt to keep the weight of this change low, the other functions for waiting in funcs.py have been refactored to reuse this new function as a basis

imnotjames commented 1 year ago

Going to mark this as a draft. I think I can get tests running and tests would make me far more confident if changes like this.