From f084685da8d6c8eecd2b13e4e5e1403443d4b818 Mon Sep 17 00:00:00 2001 From: chao an Date: Mon, 2 Sep 2024 12:49:30 +0800 Subject: [PATCH] sched/event: clear pending events before enable the scheduler enable the scheduler may cause the context to switch to a high-priority task, which will failure to clear pending events correctly. Signed-off-by: chao an --- sched/event/event_post.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sched/event/event_post.c b/sched/event/event_post.c index fe5f29a46c..eebbff843a 100644 --- a/sched/event/event_post.c +++ b/sched/event/event_post.c @@ -150,12 +150,12 @@ int nxevent_post(FAR nxevent_t *event, nxevent_mask_t events, } } - sched_unlock(); - if (clear) { event->events &= ~clear; } + + sched_unlock(); } leave_critical_section(flags);