Hello, I am learning C, POSIX, and Unix.
I am trying to write a code that wait until the child process is done then terminate, however, I do not know what to put in the while loop.
Parent function:
signal(SIGCHLD, handler)
while(child process is running)
print the number of seconds
Child function:
does something for some random amount of seconds
{
The teacher advised me to use signal(SIGCHLD, handler) part. I do not complete know what it does, all i know is that it does not ignore signal from the child. How do i know the child has ended? Basically, what do i put in the "child process is running" of my while loop. It can also be something like, while child process is not exited.
Thanks in advance guys, I am not sure if i posted in the correct thread. So sorry if i got the incorrect one.