You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2024/09/27 15:30:49 UTC

(nuttx) 02/03: sched_smp:adjust the critical section to protect refcount from multi cores access

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

commit f8053f5484e5d67c98c1cf942584710cb1581d99
Author: dulibo1 <du...@xiaomi.com>
AuthorDate: Thu Apr 18 16:43:46 2024 +0800

    sched_smp:adjust the critical section to protect refcount from multi cores access
    
    Signed-off-by: dulibo1 <du...@xiaomi.com>
    Signed-off-by: buxiasen <bu...@xiaomi.com>
---
 sched/sched/sched_smp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sched/sched/sched_smp.c b/sched/sched/sched_smp.c
index b9315ba91a..f43cb08ac7 100644
--- a/sched/sched/sched_smp.c
+++ b/sched/sched/sched_smp.c
@@ -136,6 +136,7 @@ int nxsched_smp_call_handler(int irq, FAR void *context,
 
       ret = call_data->func(call_data->arg);
 
+      flags = enter_critical_section();
       if (call_data->cookie != NULL)
         {
           if (ret < 0)
@@ -153,8 +154,6 @@ int nxsched_smp_call_handler(int irq, FAR void *context,
               spin_unlock(&call_data->lock);
             }
         }
-
-      flags = enter_critical_section();
     }
 
   up_cpu_paused_restore();