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

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

commit b96a753747bbe5da7244abfb114490352defc4be
Author: hujun5 <huj...@xiaomi.com>
AuthorDate: Mon Dec 11 10:42:23 2023 +0800

    libs/libc: There is no need to use sched_[un]lock
    
    Signed-off-by: hujun5 <huj...@xiaomi.com>
---
 libs/libc/aio/aio_suspend.c  | 9 ---------
 libs/libc/aio/lio_listio.c   | 6 ------
 libs/libc/signal/sig_pause.c | 2 --
 libs/libc/unistd/lib_chdir.c | 2 --
 4 files changed, 19 deletions(-)

diff --git a/libs/libc/aio/aio_suspend.c b/libs/libc/aio/aio_suspend.c
index cc40c87145..d15b546f14 100644
--- a/libs/libc/aio/aio_suspend.c
+++ b/libs/libc/aio/aio_suspend.c
@@ -92,13 +92,6 @@ int aio_suspend(FAR const struct aiocb * const list[], int 
nent,
 
   DEBUGASSERT(list);
 
-  /* Lock the scheduler so that no I/O events can complete on the worker
-   * thread until we set our wait set up.  Pre-emption will, of course, be
-   * re-enabled while we are waiting for the signal.
-   */
-
-  sched_lock();
-
   /* Check each entry in the list.  Break out of the loop if any entry
    * has completed.
    */
@@ -111,7 +104,6 @@ int aio_suspend(FAR const struct aiocb * const list[], int 
nent,
         {
           /* Yes, return success */
 
-          sched_unlock();
           return OK;
         }
     }
@@ -128,7 +120,6 @@ int aio_suspend(FAR const struct aiocb * const list[], int 
nent,
   sigaddset(&set, SIGPOLL);
 
   ret = sigtimedwait(&set, NULL, timeout);
-  sched_unlock();
   return ret >= 0 ? OK : ERROR;
 }
 
diff --git a/libs/libc/aio/lio_listio.c b/libs/libc/aio/lio_listio.c
index 06cb72e114..d3d93c086a 100644
--- a/libs/libc/aio/lio_listio.c
+++ b/libs/libc/aio/lio_listio.c
@@ -160,10 +160,6 @@ static void lio_sighandler(int signo, siginfo_t *info, 
void *ucontext)
   DEBUGASSERT(sighand && sighand->list);
   aiocbp->aio_priv = NULL;
 
-  /* Prevent any asynchronous I/O completions while the signal handler runs */
-
-  sched_lock();
-
   /* Check if all of the pending I/O has completed */
 
   ret = lio_checkio(sighand->list, sighand->nent);
@@ -188,8 +184,6 @@ static void lio_sighandler(int signo, siginfo_t *info, void 
*ucontext)
 
       lib_free(sighand);
     }
-
-  sched_unlock();
 }
 
 /****************************************************************************
diff --git a/libs/libc/signal/sig_pause.c b/libs/libc/signal/sig_pause.c
index 63b0cab371..fc217c93fe 100644
--- a/libs/libc/signal/sig_pause.c
+++ b/libs/libc/signal/sig_pause.c
@@ -50,7 +50,6 @@ int sigpause(int signo)
 
   /* Get the current set of blocked signals */
 
-  sched_lock();
   ret = sigprocmask(SIG_SETMASK, NULL, &set);
   if (ret == OK)
     {
@@ -66,6 +65,5 @@ int sigpause(int signo)
       ret = sigsuspend(&set);
     }
 
-  sched_unlock();
   return ret;
 }
diff --git a/libs/libc/unistd/lib_chdir.c b/libs/libc/unistd/lib_chdir.c
index 51b4315a3f..025def3bd0 100644
--- a/libs/libc/unistd/lib_chdir.c
+++ b/libs/libc/unistd/lib_chdir.c
@@ -109,7 +109,6 @@ int chdir(FAR const char *path)
    * support 'cd -' in NSH)
    */
 
-  sched_lock();
   oldpwd = getenv("PWD");
   if (!oldpwd)
     {
@@ -122,7 +121,6 @@ int chdir(FAR const char *path)
 
   ret = setenv("PWD", abspath, TRUE);
   lib_free(abspath);
-  sched_unlock();
 
   return ret;
 }

Reply via email to