apps/nshlib: When using waitpid() to wait for a built-in application or a file application to exit. Add the WUNTRACED options to so the the waitpid() call will also be awakened if the waited-for task is stopped as well.
This commit is contained in:
parent
316ffaddac
commit
9a42be5e9b
@ -153,9 +153,14 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||||||
* even if task is still active: If the I/O was re-directed by a
|
* even if task is still active: If the I/O was re-directed by a
|
||||||
* proxy task, then the ask is a child of the proxy, and not this
|
* proxy task, then the ask is a child of the proxy, and not this
|
||||||
* task. waitpid() fails with ECHILD in either case.
|
* task. waitpid() fails with ECHILD in either case.
|
||||||
|
*
|
||||||
|
* NOTE: WUNTRACED does nothing in the default case, but in the
|
||||||
|
* case the where CONFIG_SIG_SIGSTOP_ACTION=y, the built-in app
|
||||||
|
* may also be stopped. In that case WUNTRACED will force
|
||||||
|
* waitpid() to return with ECHILD.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = waitpid(ret, &rc, 0);
|
ret = waitpid(pid, &rc, WUNTRACED);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
/* If the child thread does not exist, waitpid() will return
|
/* If the child thread does not exist, waitpid() will return
|
||||||
|
@ -185,9 +185,14 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
|||||||
* Here the scheduler will be unlocked while waitpid is waiting
|
* Here the scheduler will be unlocked while waitpid is waiting
|
||||||
* and if the application has not yet run, it will now be able to
|
* and if the application has not yet run, it will now be able to
|
||||||
* do so.
|
* do so.
|
||||||
|
*
|
||||||
|
* NOTE: WUNTRACED does nothing in the default case, but in the
|
||||||
|
* case the where CONFIG_SIG_SIGSTOP_ACTION=y, the file app
|
||||||
|
* may also be stopped. In that case WUNTRACED will force
|
||||||
|
* waitpid() to return with ECHILD.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret = waitpid(pid, &rc, 0);
|
ret = waitpid(pid, &rc, WUNTRACED);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
/* If the child thread does not exist, waitpid() will return
|
/* If the child thread does not exist, waitpid() will return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user