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 0519dc023583ced4e04c861707c3b329b040be1e
Author: hujun5 <[email protected]>
AuthorDate: Mon Dec 11 11:41:22 2023 +0800

    sched/task: There is no need to use sched_[un]lock
    
    Signed-off-by: hujun5 <[email protected]>
---
 sched/task/task_exithook.c | 11 -----------
 sched/task/task_fork.c     |  9 ---------
 2 files changed, 20 deletions(-)

diff --git a/sched/task/task_exithook.c b/sched/task/task_exithook.c
index 6e0d51fa19..9b72d34fe0 100644
--- a/sched/task/task_exithook.c
+++ b/sched/task/task_exithook.c
@@ -272,21 +272,12 @@ static inline void nxtask_signalparent(FAR struct tcb_s 
*ctcb, int status)
 #ifdef HAVE_GROUP_MEMBERS
   DEBUGASSERT(ctcb && ctcb->group);
 
-  /* Keep things stationary throughout the following */
-
-  sched_lock();
-
   /* Send SIGCHLD to all members of the parent's task group */
 
   nxtask_sigchild(ctcb->group->tg_ppid, ctcb, status);
-  sched_unlock();
 #else
   FAR struct tcb_s *ptcb;
 
-  /* Keep things stationary throughout the following */
-
-  sched_lock();
-
   /* Get the TCB of the receiving, parent task.  We do this early to
    * handle multiple calls to nxtask_signalparent.
    */
@@ -296,7 +287,6 @@ static inline void nxtask_signalparent(FAR struct tcb_s 
*ctcb, int status)
     {
       /* The parent no longer exists... bail */
 
-      sched_unlock();
       return;
     }
 
@@ -307,7 +297,6 @@ static inline void nxtask_signalparent(FAR struct tcb_s 
*ctcb, int status)
    */
 
   nxtask_sigchild(ptcb, ctcb, status);
-  sched_unlock();
 #endif
 }
 #else
diff --git a/sched/task/task_fork.c b/sched/task/task_fork.c
index fca28ab802..44551f32d4 100644
--- a/sched/task/task_fork.c
+++ b/sched/task/task_fork.c
@@ -320,19 +320,10 @@ pid_t nxtask_start_fork(FAR struct task_tcb_s *child)
 
   pid = child->cmn.pid;
 
-  /* Eliminate a race condition by disabling pre-emption.  The child task
-   * can be instantiated, but cannot run until we call waitpid().  This
-   * assures us that we cannot miss the death-of-child signal (only
-   * needed in the SMP case).
-   */
-
-  sched_lock();
-
   /* Activate the task */
 
   nxtask_activate((FAR struct tcb_s *)child);
 
-  sched_unlock();
   return pid;
 }
 

Reply via email to