Check out example codes for "c waitpid". It will help you in understanding the concepts better.

Code Example 1

#include <sys/types.h>
#include <sys/wait.h>

pid_t wait(int *status);
pid_t waitpid(pid_t pid, int *status, int options);

Learn ReactJs, React Native from akashmittal.com