Now checks the return value of wait_for_thread() and print out an error message if it fails.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19804 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-01-15 10:11:03 +00:00
parent 49b3453720
commit d60fa6c96f
3 changed files with 51 additions and 20 deletions
+17 -7
View File
@@ -83,14 +83,24 @@ main(int argc, char *argv[])
return -1; return -1;
} }
status_t status; status_t status, returnValue = 0;
while (wait_for_thread(childA, &status) == B_INTERRUPTED) do {
; status = wait_for_thread(childA, &returnValue);
result = status; } while (status == B_INTERRUPTED);
while (wait_for_thread(childB, &status) == B_INTERRUPTED) if (status == B_OK)
; result = returnValue;
result += status; 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) { if (silent) {
+17 -7
View File
@@ -70,14 +70,24 @@ main(int argc, char *argv[])
return -1; return -1;
} }
status_t status; status_t status, returnValue = 0;
while (wait_for_thread(childA, &status) == B_INTERRUPTED) do {
; status = wait_for_thread(childA, &returnValue);
result = status; } while (status == B_INTERRUPTED);
while (wait_for_thread(childB, &status) == B_INTERRUPTED) if (status == B_OK)
; result = returnValue;
result += status; 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) { if (gForked) {
+17 -6
View File
@@ -71,13 +71,24 @@ main(int argc, char *argv[])
resume_thread(threadA); resume_thread(threadA);
resume_thread(threadB); resume_thread(threadB);
while (wait_for_thread(threadA, &status) == B_INTERRUPTED) status_t returnValue = 0;
; do {
result = status; status = wait_for_thread(threadA, &returnValue);
} while (status == B_INTERRUPTED);
while (wait_for_thread(threadB, &status) == B_INTERRUPTED) if (status == B_OK)
; result = returnValue;
result += status; 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) { if (silent) {