summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarc <marc@openbsd.org>2002-02-17 05:44:38 +0000
committermarc <marc@openbsd.org>2002-02-17 05:44:38 +0000
commitb7d634bc5a929a8db01eb3c764e1e2d71cf13c74 (patch)
tree63adae9eebe271264a622e133125ad10819e3cca
parenttest rfork with shared fds (diff)
downloadwireguard-openbsd-b7d634bc5a929a8db01eb3c764e1e2d71cf13c74.tar.xz
wireguard-openbsd-b7d634bc5a929a8db01eb3c764e1e2d71cf13c74.zip
use semaphore to sync threads, not sleep
-rw-r--r--regress/lib/libc_r/cancel/cancel.c5
-rw-r--r--regress/lib/libpthread/cancel/cancel.c5
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();