You can use waitpid() in Linux if you want to just wait infinitely for the process to die.
在 Linux 中,如果您希望无限期等待进程被杀死,则可以使用 waitpid()。
ECHILD -- The wait() or waitpid() function tried to wait for a child process to exit, but all children have already exited.
ECHILD:wait() 或 waitpid() 函数尝试等待退出子进程,但所有子项都已经退出。
In this code: pid_t waitpid(pid_t pid, int *status, int options), waitpid() infinitely waits for the child process to terminate.
在这段代码中:pid_t waitpid(pid_t pid, int *status, int options),waitpid() 会无限期等待子进程的终止。
应用推荐