mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-19 19:44:35 +08:00
nsh:support wait command to wait task exit.
usage like: nsh> sleep 10 & [5:100] nsh>set pid1=$! nsh>sleep 15 & [6:100] nsh>set pid2=$! nsh>wait $pid1 $pid2 'wait' command will block nsh from running until pid1 and pid2 finish. This is useful for parallel requirements to perform certain tasks Signed-off-by: anjiahao <anjiahao@xiaomi.com>
This commit is contained in:
@@ -666,6 +666,11 @@ static const struct cmdmap_s g_cmdmap[] =
|
||||
|
||||
#ifndef CONFIG_NSH_DISABLE_XD
|
||||
CMD_MAP("xd", cmd_xd, 3, 3, "<hex-address> <byte-count>"),
|
||||
#endif
|
||||
#if !defined(CONFIG_NSH_DISABLE_WAIT) && defined(CONFIG_SCHED_WAITPID) && \
|
||||
!defined(CONFIG_DISABLE_PTHREAD)
|
||||
CMD_MAP("wait", cmd_wait, 1, CONFIG_NSH_MAXARGUMENTS,
|
||||
"pid1 [pid2 [pid3] ...]"),
|
||||
#endif
|
||||
CMD_MAP(NULL, NULL, 1, 1, NULL)
|
||||
};
|
||||
|
Reference in New Issue
Block a user