docs/library/uasyncio.rst: Add docs for ThreadSafeFlag.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This commit is contained in:
parent
5e96e89999
commit
cdf9c8648f
@ -125,6 +125,9 @@ class Event
|
||||
|
||||
Set the event. Any tasks waiting on the event will be scheduled to run.
|
||||
|
||||
Note: This must be called from within a task. It is not safe to call this
|
||||
from an IRQ, scheduler callback, or other thread. See `ThreadSafeFlag`.
|
||||
|
||||
.. method:: Event.clear()
|
||||
|
||||
Clear the event.
|
||||
@ -136,6 +139,29 @@ class Event
|
||||
|
||||
This is a coroutine.
|
||||
|
||||
class ThreadSafeFlag
|
||||
--------------------
|
||||
|
||||
.. class:: ThreadSafeFlag()
|
||||
|
||||
Create a new flag which can be used to synchronise a task with code running
|
||||
outside the asyncio loop, such as other threads, IRQs, or scheduler
|
||||
callbacks. Flags start in the cleared state.
|
||||
|
||||
.. method:: ThreadSafeFlag.set()
|
||||
|
||||
Set the flag. If there is a task waiting on the event, it will be scheduled
|
||||
to run.
|
||||
|
||||
.. method:: ThreadSafeFlag.wait()
|
||||
|
||||
Wait for the flag to be set. If the flag is already set then it returns
|
||||
immediately.
|
||||
|
||||
A flag may only be waited on by a single task at a time.
|
||||
|
||||
This is a coroutine.
|
||||
|
||||
class Lock
|
||||
----------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user