docs: Rename uasyncio to asyncio.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
Jim Mussared
2023-06-08 16:08:09 +10:00
committed by Damien George
parent 6027c41c8f
commit 9092909bf5
5 changed files with 30 additions and 30 deletions

View File

@@ -219,20 +219,20 @@ Exceptions
If an ISR raises an exception it will not propagate to the main loop. The interrupt will be disabled unless the
exception is handled by the ISR code.
Interfacing to uasyncio
-----------------------
Interfacing to asyncio
----------------------
When an ISR runs it can preempt the `uasyncio` scheduler. If the ISR performs a `uasyncio`
When an ISR runs it can preempt the `asyncio` scheduler. If the ISR performs a `asyncio`
operation the scheduler's operation can be disrupted. This applies whether the interrupt is hard
or soft and also applies if the ISR has passed execution to another function via
`micropython.schedule`. In particular creating or cancelling tasks is invalid in an ISR context.
The safe way to interact with `uasyncio` is to implement a coroutine with synchronisation performed by
`uasyncio.ThreadSafeFlag`. The following fragment illustrates the creation of a task in response
The safe way to interact with `asyncio` is to implement a coroutine with synchronisation performed by
`asyncio.ThreadSafeFlag`. The following fragment illustrates the creation of a task in response
to an interrupt:
.. code:: python
tsf = uasyncio.ThreadSafeFlag()
tsf = asyncio.ThreadSafeFlag()
def isr(_): # Interrupt handler
tsf.set()
@@ -240,7 +240,7 @@ to an interrupt:
async def foo():
while True:
await tsf.wait()
uasyncio.create_task(bar())
asyncio.create_task(bar())
In this example there will be a variable amount of latency between the execution of the ISR and the execution
of ``foo()``. This is inherent to cooperative scheduling. The maximum latency is application