need some help with my code , im supposed to fork a child and wait for it co complete processing the fib , which it then has to output to shared memory where the parent will print out to screen.
all im gettin thus far is error 218 when im waiting for the child to complete. where am i going wrong , my code below.
The child process not finished when the calling thread is running.you must be waitting the child process finished,so
you should changed the code:
wpi = waitpid( pID,&status,WUNTRACED);
man waitpid subroutine hints:
The WNOHANG option prevents the
calling thread from being suspended even if there are child processes to wait for. In this
case, a value of 0 is returned indicating there are no child processes that have stopped or
terminated. If the WUNTRACED option is set, the call should also return information when
children of the current process are stopped because they received a SIGTTIN, SIGTTOU,
SIGSSTP, or SIGTSTOP signal.