I have found waitpid very useful for my project but have recently discovered that it uses the entire CPU while it waits. Is there any change that could be made to the code so that it blocks execution without consuming resources during the wait? The problem is with this loop
do {
r = waitpid(child, &status, WNOHANG);
} while (r != -1);
I have found waitpid very useful for my project but have recently discovered that it uses the entire CPU while it waits. Is there any change that could be made to the code so that it blocks execution without consuming resources during the wait? The problem is with this loop