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-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 3ff49e86f nshlib/nsh_fileapps.c: Remove sched_lock() from nsh_fileapp()
3ff49e86f is described below

commit 3ff49e86f5fc41c63bdad23e521f22896692b3f8
Author: Ville Juven <[email protected]>
AuthorDate: Wed Oct 25 13:18:03 2023 +0300

    nshlib/nsh_fileapps.c: Remove sched_lock() from nsh_fileapp()
    
    Locking the scheduler prior to calling posix_spawn() might lock the
    scheduler for a relatively long time, if the file to be loaded is large.
    
    posix_spawn() loads the process into memory, possibly linking it as well
    if the binary format is linkable (elf). This can take tens / hundreds of
    milliseconds, which basically destroys the OS's real time performance.
    
    Missing the death-of-child signal is a very trivial penalty considering
    the alternative.
---
 nshlib/nsh_fileapps.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/nshlib/nsh_fileapps.c b/nshlib/nsh_fileapps.c
index 804c0062d..e279ea2d4 100644
--- a/nshlib/nsh_fileapps.c
+++ b/nshlib/nsh_fileapps.c
@@ -159,12 +159,6 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const 
char *cmd,
     }
 #endif
 
-  /* Lock the scheduler in an attempt to prevent the application from
-   * running until waitpid() has been called.
-   */
-
-  sched_lock();
-
   /* Execute the program. posix_spawnp returns a positive errno value on
    * failure.
    */
@@ -296,8 +290,6 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char 
*cmd,
 #endif /* !CONFIG_SCHED_WAITPID || !CONFIG_NSH_DISABLEBG */
     }
 
-  sched_unlock();
-
   /* Free attributes and file actions.  Ignoring return values in the case
    * of an error.
    */

Reply via email to