Usage of waitpid non-blocking

  



We use this program and output to analyze the usage and characteristics of waitpid. We set waitpid to WNOHANG non-blocking parent process state; the first time waitpid is called: there is no child process at this time, so waitpid error, return -1; the second call waitpid: there are child processes at this time, but the child process Not yet finished, since waitpid is set to non-blocking, waitpid returns 0; the third time waitpid: there is a child process, so waitpid returns the child process id;

Copyright © Windows knowledge All Rights Reserved