diff --git a/src/tests/system/kernel/fibo_exec.cpp b/src/tests/system/kernel/fibo_exec.cpp index c39de62c61..d2d55123a8 100644 --- a/src/tests/system/kernel/fibo_exec.cpp +++ b/src/tests/system/kernel/fibo_exec.cpp @@ -83,14 +83,24 @@ main(int argc, char *argv[]) return -1; } - status_t status; - while (wait_for_thread(childA, &status) == B_INTERRUPTED) - ; - result = status; + status_t status, returnValue = 0; + do { + status = wait_for_thread(childA, &returnValue); + } while (status == B_INTERRUPTED); - while (wait_for_thread(childB, &status) == B_INTERRUPTED) - ; - result += status; + if (status == B_OK) + result = returnValue; + else + fprintf(stderr, "wait_for_thread(%ld) A failed: %s\n", childA, strerror(status)); + + do { + status = wait_for_thread(childB, &returnValue); + } while (status == B_INTERRUPTED); + + if (status == B_OK) + result += returnValue; + else + fprintf(stderr, "wait_for_thread(%ld) B failed: %s\n", childB, strerror(status)); } if (silent) { diff --git a/src/tests/system/kernel/fibo_fork.cpp b/src/tests/system/kernel/fibo_fork.cpp index 29c1a3957a..baafd8e5cf 100644 --- a/src/tests/system/kernel/fibo_fork.cpp +++ b/src/tests/system/kernel/fibo_fork.cpp @@ -70,14 +70,24 @@ main(int argc, char *argv[]) return -1; } - status_t status; - while (wait_for_thread(childA, &status) == B_INTERRUPTED) - ; - result = status; + status_t status, returnValue = 0; + do { + status = wait_for_thread(childA, &returnValue); + } while (status == B_INTERRUPTED); - while (wait_for_thread(childB, &status) == B_INTERRUPTED) - ; - result += status; + if (status == B_OK) + result = returnValue; + else + fprintf(stderr, "wait_for_thread(%ld) A failed: %s\n", childA, strerror(status)); + + do { + status = wait_for_thread(childB, &returnValue); + } while (status == B_INTERRUPTED); + + if (status == B_OK) + result += returnValue; + else + fprintf(stderr, "wait_for_thread(%ld) B failed: %s\n", childB, strerror(status)); } if (gForked) { diff --git a/src/tests/system/kernel/fibo_load_image.cpp b/src/tests/system/kernel/fibo_load_image.cpp index ef302ef30c..e7d0a09e17 100644 --- a/src/tests/system/kernel/fibo_load_image.cpp +++ b/src/tests/system/kernel/fibo_load_image.cpp @@ -71,13 +71,24 @@ main(int argc, char *argv[]) resume_thread(threadA); resume_thread(threadB); - while (wait_for_thread(threadA, &status) == B_INTERRUPTED) - ; - result = status; + status_t returnValue = 0; + do { + status = wait_for_thread(threadA, &returnValue); + } while (status == B_INTERRUPTED); - while (wait_for_thread(threadB, &status) == B_INTERRUPTED) - ; - result += status; + if (status == B_OK) + result = returnValue; + else + fprintf(stderr, "wait_for_thread(%ld) A failed: %s\n", threadA, strerror(status)); + + do { + status = wait_for_thread(threadB, &returnValue); + } while (status == B_INTERRUPTED); + + if (status == B_OK) + result += returnValue; + else + fprintf(stderr, "wait_for_thread(%ld) B failed: %s\n", threadB, strerror(status)); } if (silent) {