!1446 waitpid优化等待所有子进程退出

Merge pull request !1446 from liveery/master
This commit is contained in:
openharmony_ci 2024-09-08 08:22:12 +00:00 committed by Gitee
commit 7b467b04d8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -179,7 +179,7 @@ APPSPAWN_STATIC void ProcessSignal(const struct signalfd_siginfo *siginfo)
case SIGCHLD: { // delete pid from app map
pid_t pid;
int status;
while ((pid = waitpid(siginfo->ssi_pid, &status, WNOHANG)) > 0) {
while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
APPSPAWN_CHECK(WIFSIGNALED(status) || WIFEXITED(status), return,
"ProcessSignal with wrong status:%{public}d", status);
HandleDiedPid(pid, siginfo->ssi_uid, status);