File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -909,7 +909,12 @@ Asynchronous method:
909
909
* ` wait ` Wait for the flag to be set. If the flag is already set then it
910
910
returns immediately.
911
911
912
- Usage example: triggering from a hard ISR.
912
+ Typical usage is having a ` uasyncio ` task wait on a hard ISR. Only one task
913
+ should wait on a ` ThreadSafeFlag ` . The hard ISR services the interrupting
914
+ device, sets the ` ThreadSafeFlag ` , and quits. A single task waits on the flag.
915
+ This design conforms with the self-clearing behaviour of the ` ThreadSafeFlag ` .
916
+ Each interrupting device has its own ` ThreadSafeFlag ` instance and its own
917
+ waiting task.
913
918
``` python
914
919
import uasyncio as asyncio
915
920
from pyb import Timer
@@ -967,8 +972,8 @@ possible level of performance as discussed in
967
972
968
973
Regardless of performance issues, a key use for ` ThreadSafeFlag ` is where a
969
974
hardware device requires the use of an ISR for a μs level response. Having
970
- serviced the device, the ISR flags an asynchronous routine, say to process
971
- received data.
975
+ serviced the device, the ISR flags an asynchronous routine, typically
976
+ processing received data.
972
977
973
978
The fact that only one task may wait on a ` ThreadSafeFlag ` may be addressed by
974
979
having the task that waits on the ` ThreadSafeFlag ` set an ` Event ` . Multiple
You can’t perform that action at this time.
0 commit comments