When a child process terminates, SIGCHLD
signal is sent to parent. waitpid
function with WNOHANG
flag can be used to check if a child process has terminated or is still running. Probably, you'll want to combine those both methods.
how to know if a process which run in the background finished or not
-
04-07-2022 - |
문제
I coded a basic shell in C for executing basic commands like ls , pwd , ...
I have a feature that can make a process run in the background instead of waiting until its done for example : ls & instead of ls (I have a list that contains the processes that run in the background now)
The whole thing is that I want to know when a process is done or not , so I can remove it from the list .
thanks
해결책
제휴하지 않습니다 StackOverflow