diff options
author | David Leonard <d@cvs.openbsd.org> | 1999-11-26 05:17:07 +0000 |
---|---|---|
committer | David Leonard <d@cvs.openbsd.org> | 1999-11-26 05:17:07 +0000 |
commit | 54b898bf12c46645c28a64185fca41f77f6f522c (patch) | |
tree | a21622ef4d30786dddd289c01c223cfbf8fa3a03 | |
parent | 3eda653ec906671d62d0afc871d201909b9accac (diff) |
use pthread_join instead of pthread_cancel to test for a thread's existence after forking
-rw-r--r-- | lib/libc_r/TEST/test_fork.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc_r/TEST/test_fork.c b/lib/libc_r/TEST/test_fork.c index ab53ec41d4c..60a7181a4ad 100644 --- a/lib/libc_r/TEST/test_fork.c +++ b/lib/libc_r/TEST/test_fork.c @@ -22,7 +22,7 @@ sleeper(void *arg) { pthread_set_name_np(pthread_self(), "slpr"); - sleep(10); + sleep(2); PANIC("sleeper timed out"); } @@ -53,6 +53,7 @@ main() int flags; pid_t pid; pthread_t sleeper_thread; + void *result; parent_pid = getpid(); @@ -77,7 +78,7 @@ main() /* Our pid should change */ ASSERT(getpid() != parent_pid); /* Our sleeper thread should have disappeared */ - ASSERT(ESRCH == pthread_cancel(sleeper_thread)); + ASSERT(ESRCH == pthread_join(sleeper_thread, &result)); printf("child ok\n"); _exit(0); PANIC("child _exit"); @@ -87,7 +88,7 @@ main() /* Our pid should stay the same */ ASSERT(getpid() == parent_pid); /* Our sleeper thread should still be around */ - CHECKr(pthread_cancel(sleeper_thread)); + CHECKr(pthread_join(sleeper_thread, &result)); /* wait for the SIGCHLD from the child */ CHECKe(pause()); PANIC("pause"); |