Skip to content

Commit 04c524e

Browse files
committed
Moving Parent waiting messaging above loop
1 parent 42dc8c6 commit 04c524e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sys_opt/multiple_process/src/host.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ int main(int argc, char *argv[]) {
174174
}
175175

176176
// Need to wait for all child process to complete
177+
std::cout << "\n[PID: " << getpid() << "] PARENT WAITS CHILD TO FINISH.\n\n"
178+
<< std::endl;
177179
for (int i = 0; i < iter; i++) {
178180
int status = 0;
179181
int child = wait(&status);
@@ -183,8 +185,6 @@ int main(int argc, char *argv[]) {
183185
if (WEXITSTATUS(status) and WIFEXITED(status))
184186
result = false;
185187
}
186-
std::cout << "\n[PID: " << getpid() << "] PARENT WAITS CHILD TO FINISH.\n\n"
187-
<< std::endl;
188188

189189
std::cout << "TEST " << ((result) ? "PASSED" : "FAILED") << std::endl;
190190
return ((result) ? EXIT_SUCCESS : EXIT_FAILURE);

0 commit comments

Comments
 (0)