mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
sched/event: Fix uninitialized need_switch flag issue in event_post()
The `need_switch` flag was not initialized in `event_post()`. Since it is
a local variable, it could contain a random non-zero value, leading to
incorrect behavior.
In addition, this patch also fixes an issue where the event clearing
operation in `event_post()` was not performed correctly.
Signed-off-by: Chengdong Wang wangchengdong@lixiang.com
This commit is contained in:
parent
e7ad870f18
commit
522f32f7ef
1 changed files with 5 additions and 5 deletions
|
|
@ -68,7 +68,7 @@ int nxevent_post(FAR nxevent_t *event, nxevent_mask_t events,
|
|||
dq_queue_t *waitlist;
|
||||
bool waitall;
|
||||
bool postall;
|
||||
bool need_switch;
|
||||
bool need_switch = false;
|
||||
|
||||
if (event == NULL)
|
||||
{
|
||||
|
|
@ -133,11 +133,11 @@ int nxevent_post(FAR nxevent_t *event, nxevent_mask_t events,
|
|||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clear)
|
||||
{
|
||||
event->events &= ~clear;
|
||||
}
|
||||
if (clear != 0)
|
||||
{
|
||||
event->events &= ~clear;
|
||||
}
|
||||
|
||||
if (need_switch)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue