QUERY · ISSUE
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
CANDIDATE · PULL REQUEST
uasyncio.core: Fix scheduling in the presense of I/O completion callbacks.
wait() may finish prematurely due to I/O completion, and schedule new,
earlier than before tasks to run. So, after call to wait(), we need to
check current time and time of head task, and continue to wait if needed.
Recently introduced provisional utimeq.peektime() is used to optimize
querying time of a head task.
For review to: @dpgeorge , @peterhinch, @prusnak, @jpochyla.
Note that there's a testcase which now passes: https://github.com/micropython/micropython-lib/commit/aa9bbe839eac5bce0a0e5169f63730b13a638b64 . Full uasyncio integration tests weren't yet run though.
It looks ok to me.
It fixes https://github.com/micropython/micropython/issues/3005.
Ok, thanks for testing! I also ran standard uasyncio integration tests, all's ok, so I'm merging this to master. But not tagging a new release yet, so there's still time to catch last-minute regressions ;-).
Finally pushed to PyPI.