extmod/uasyncio Provide means of scheduling I/O with high priority
This was discussed at length in the past, and prototyped with early code of this uasyncio. There is known demand for it in high speed UART applications and audio processing. Salient points:
- Enable I/O readiness to be tested on every pass of the scheduler.
- The facility to be available on a per-interface basis. A subset of active interfaces can be selected to run at high priority.
This would improve real time throughput and reduce buffering requirements
RFC asyncio: efficiently polling devices
A common situation when interfacing hardware is the case where a device which is normally not ready needs to be polled. One solution is along the lines of
async def poll(device):
while True:
if device.ready():
device.handle_data()
yield
This works but has a high worst case latency. If there are N coroutines each with a maximum latency of T between yield statements, an interval of up to NT will exist between calls to device.ready(). This can be reduced to T if there is a way to delegate the polling to the scheduler. In other words to provide a facility to schedule on an event (cf the Poller class in my scheduler).
Any comments on ways to achieve this with uasyncio? Perhaps there's a solution which I've missed.
To anyone interested I've ported my classes for debounced switches and pushbuttons to asyncio and plan to extend this to other drivers. Preliminary code and docs here.