From b62801dd8124a0a8a0439255dc70397ec7337da8 Mon Sep 17 00:00:00 2001 From: Ville Juven Date: Wed, 25 Oct 2023 13:18:03 +0300 Subject: [PATCH] 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 804c0062da..e279ea2d42 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. */