We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 880314f commit d362ab0Copy full SHA for d362ab0
sys_opt/multiple_process/src/host.cpp
@@ -174,8 +174,15 @@ int main(int argc, char *argv[]) {
174
}
175
176
// Need to wait for all child process to complete
177
- for (int i = 0; i < iter; i++)
178
- wait(NULL);
+ for (int i = 0; i < iter; i++) {
+ int status = 0;
179
+ int child = wait(&status);
180
+ std::cout << "[PID: " << getpid() << "] child: " << child
181
+ << " exited with WIFEXITED: " << WIFEXITED(status)
182
+ << " and WEXITSTATUS: " << WEXITSTATUS(status) << std::endl;
183
+ if (WEXITSTATUS(status))
184
+ result = false;
185
+ }
186
std::cout << "\n[PID: " << getpid() << "] PARENT WAITS CHILD TO FINISH.\n\n"
187
<< std::endl;
188
0 commit comments