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:
anjiahao
2023-12-27 14:57:30 +08:00
committed by Xiang Xiao
parent 8d1966e9fc
commit c916f163f2
7 changed files with 179 additions and 6 deletions

View File

@@ -1231,6 +1231,11 @@ int cmd_alias(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv);
int cmd_unalias(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv);
#endif
#if !defined(CONFIG_NSH_DISABLE_WAIT) && defined(CONFIG_SCHED_WAITPID) && \
!defined(CONFIG_DISABLE_PTHREAD)
int cmd_wait(FAR struct nsh_vtbl_s *vtbl, int argc, FAR char **argv);
#endif
/****************************************************************************
* Name: nsh_extmatch_count
*