diff options
author | Marco S Hyman <marc@cvs.openbsd.org> | 2002-02-17 05:44:39 +0000 |
---|---|---|
committer | Marco S Hyman <marc@cvs.openbsd.org> | 2002-02-17 05:44:39 +0000 |
commit | e7dfaead07ecdc314999e4f913d86405f2245ab8 (patch) | |
tree | 345c51ab3ca6ee70e4828ab357005a6946d44e05 /regress | |
parent | 6e7c01afd33f3207ec5849170599032a7c97b339 (diff) |
use semaphore to sync threads, not sleep
Diffstat (limited to 'regress')
-rw-r--r-- | regress/lib/libc_r/cancel/cancel.c | 5 | ||||
-rw-r--r-- | regress/lib/libpthread/cancel/cancel.c | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/regress/lib/libc_r/cancel/cancel.c b/regress/lib/libc_r/cancel/cancel.c index 6f9359246d2..4c70a229bcd 100644 --- a/regress/lib/libc_r/cancel/cancel.c +++ b/regress/lib/libc_r/cancel/cancel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cancel.c,v 1.4 2002/02/17 04:33:33 marc Exp $ */ +/* $OpenBSD: cancel.c,v 1.5 2002/02/17 05:44:38 marc Exp $ */ /* David Leonard <d@openbsd.org>, 1999. Public Domain. */ #include <pthread.h> @@ -111,6 +111,7 @@ child2fn(arg) message_seen++; c2_in_test = 0; ASSERT(message_seen == 1); + v(); } PANIC("child 2"); } @@ -162,7 +163,7 @@ main() p(); /* Give thread 2 a chance to go through its deferred loop once */ - sleep(2); + p(); CHECKr(pthread_cancel(child2)); p(); diff --git a/regress/lib/libpthread/cancel/cancel.c b/regress/lib/libpthread/cancel/cancel.c index 6f9359246d2..4c70a229bcd 100644 --- a/regress/lib/libpthread/cancel/cancel.c +++ b/regress/lib/libpthread/cancel/cancel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cancel.c,v 1.4 2002/02/17 04:33:33 marc Exp $ */ +/* $OpenBSD: cancel.c,v 1.5 2002/02/17 05:44:38 marc Exp $ */ /* David Leonard <d@openbsd.org>, 1999. Public Domain. */ #include <pthread.h> @@ -111,6 +111,7 @@ child2fn(arg) message_seen++; c2_in_test = 0; ASSERT(message_seen == 1); + v(); } PANIC("child 2"); } @@ -162,7 +163,7 @@ main() p(); /* Give thread 2 a chance to go through its deferred loop once */ - sleep(2); + p(); CHECKr(pthread_cancel(child2)); p(); |