Commit 316452c
portability: cmsis: Fix possible race in osEventFlagsClear()
The CMSIS-RTOS specification says "The function returns the event flags
before clearing".
In the original code, if another thread set an event between k_event_test()
and k_event_clear(), there was a risk the function clear a flag without
reporting it to the caller:
T1 T2
k_event_test(..) == 0 ...
... k_event_post(.. 1)
k_event_clear(.. 1) ...
return 0 (while event 1 has been cleared)
Signed-off-by: Jérôme Pouiller <[email protected]>1 parent fd50016 commit 316452c
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
82 | | - | |
| 82 | + | |
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| |||
0 commit comments