This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new c0d7269840a sched/event: fix event bug after csection was removed
c0d7269840a is described below

commit c0d7269840a27cf0e23efba9d8b4bc36df46f7f7
Author: wangchengdong <[email protected]>
AuthorDate: Mon Sep 8 18:35:31 2025 +0800

    sched/event: fix event bug after csection was removed
    
      Change:
        Replace list_delete_init() with list_delete() in nxevent_post.
      Reason:
        PR 16933 removed list_delete() in nxevent_wait() and  allow other task
        to preempt event-wait thread after list_add_tail() option,  the 
even-post thread
        can preempt it at this time and do  list_delete_init().
    
        The problem is that list_delete_init() will make  list_in_list() return 
true, so
        DEBUGASSERT(!list_in_list(&(wait->node))); will fail in nxevent_wait() 
after the event-wait thread
        returns.
    
    Signed-off-by: Chengdong Wang <[email protected]>
---
 sched/event/event_post.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sched/event/event_post.c b/sched/event/event_post.c
index a6eee49e4e8..056107b87eb 100644
--- a/sched/event/event_post.c
+++ b/sched/event/event_post.c
@@ -104,7 +104,7 @@ int nxevent_post(FAR nxevent_t *event, nxevent_mask_t 
events,
           if ((!waitall && ((wait->expect & event->events) != 0)) ||
               (waitall && ((wait->expect & event->events) == wait->expect)))
             {
-              list_delete_init(&wait->node);
+              list_delete(&wait->node);
 
               ret = nxsem_post(&wait->sem);
               if (ret < 0)

Reply via email to