Wykres commitów

9 Commity (f74001c8a268790097108856bd2365867747d16f)

Autor SHA1 Wiadomość Data
Jared Hancock f74001c8a2 asyncio: Make slight optimizations for IOQueue.wait_io_event
Calculate ~POLLIN and ~POLLOUT as constants to remove the runtime cost
of continuously calculating them. And unpack the queue entry rather than
using repeated item lookups.
2024-03-09 16:30:31 -06:00
Jared Hancock c4b3fb43a0 asyncio: Handle case where waio_io_event returns early 2024-03-09 16:30:26 -06:00
Jared Hancock 0e5e1ffaa5 uasyncio: Always call wait_io_queue 2024-03-09 10:10:02 -06:00
Jared Hancock 0cb54ddfab uasyncio: Avoid call to max() in sleep_ms
This seems to additionally reduce the overhead of uasyncio.sleep().
2024-03-09 10:10:02 -06:00
Jared Hancock 0b80a69344 asyncio: Properly cancel the main task on exception
If the main task is interrupted by e.g. a KeyboardInterrupt, then the
main task needs to have the exception injected into it so it will run
the exception handlers and contextmanager __aexit__ methods.
2024-03-09 10:10:02 -06:00
Damien George 8692d2602a extmod/asyncio: Make current_task raise exception when there is no task.
Matches CPython behaviour.

Fixes issue #11530.

Signed-off-by: Damien George <damien@micropython.org>
2024-02-28 15:48:51 +11:00
Damien George 2ecbad4e91 extmod/asyncio: Support gather of tasks that finish early.
Adds support to asyncio.gather() for the case that one or more (or all)
sub-tasks finish and/or raise an exception before the gather starts.

Signed-off-by: Damien George <damien@micropython.org>
2024-01-22 12:03:21 +11:00
Matthias Urlichs 5f0bd33b73 extmod/asyncio: Emit errors to stderr, not stdout.
Sometimes these are different file descriptors, not to mention the Unix
port, so use stderr to distinguish these error messages.

CPython prints to stdout, but it does it via a call to the logging module.
We don't want to introduce a dependency on logging, so printing to stderr
is a good alternative.  One can override default_exception_handler() if
needed.
2023-10-13 14:55:54 +11:00
Jim Mussared 2fbc08c462 extmod/asyncio: Rename uasyncio to asyncio.
The asyncio module now has much better CPython compatibility and
deserves to be just called "asyncio".

This will avoid people having to write `from uasyncio import asyncio`.

Renames all files, and updates port manifests to use the new path. Also
renames the built-in _uasyncio to _asyncio.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-19 17:33:03 +10:00