In Unix, C. After a fork()
, usually followed by a wait()
or waitpid()
to wait the child
terminate. But can the child
execute the wait()
? The child
doesn't have a _child_
, so when it execute the wait()
, what will happen?
There are no child proccess for the child proces so wait()
will return -1. From the man page:
wait(): on success, returns the process ID of the terminated child; on error, -1 is returned.