diff options
| author | Ned Konz <ned@productcreationstudio.com> | 2021-09-01 10:48:15 -0700 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-08-12 17:06:28 +1000 |
| commit | 5543b2a9cc7381931431c69d93a77ba5d5d58e2e (patch) | |
| tree | b1c517f319d16e5a893cfa08fcde4e7a105dc15b /docs/library | |
| parent | cf90e24335652462bb7eb4bd105e061683bc316a (diff) | |
extmod/uasyncio: Add clear method to ThreadSafeFlag.
This is useful in situations where the ThreadSafeFlag is reused and needs
to be cleared of any previous, unwanted event.
For example, clear the flag at the start of an operation, trigger the
operation (eg an I2C write), then (a)wait for an external event to set the
flag (eg a pin IRQ). Further events may trigger the flag again but these
are unwanted and should be cleared before the next cycle starts.
Diffstat (limited to 'docs/library')
| -rw-r--r-- | docs/library/uasyncio.rst | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/docs/library/uasyncio.rst b/docs/library/uasyncio.rst index 0abbf8dd8..859d505d7 100644 --- a/docs/library/uasyncio.rst +++ b/docs/library/uasyncio.rst @@ -153,9 +153,14 @@ class ThreadSafeFlag .. method:: ThreadSafeFlag.set() - Set the flag. If there is a task waiting on the event, it will be scheduled + Set the flag. If there is a task waiting on the flag, it will be scheduled to run. +.. method:: ThreadSafeFlag.clear() + + Clear the flag. This may be used to ensure that a possibly previously-set + flag is clear before waiting for it. + .. method:: ThreadSafeFlag.wait() Wait for the flag to be set. If the flag is already set then it returns |
