summaryrefslogtreecommitdiff
path: root/regress/lib/libpthread
diff options
context:
space:
mode:
authorMarco S Hyman <marc@cvs.openbsd.org>2002-10-12 03:00:12 +0000
committerMarco S Hyman <marc@cvs.openbsd.org>2002-10-12 03:00:12 +0000
commite9f1823c2ace3b7f239bdad103e1c4d0d3395593 (patch)
treea9da70eb9baa7bddc4761a32a972f22c2f9879c6 /regress/lib/libpthread
parentba7143679bec7e8bdb5439290a2e12838da8a539 (diff)
Do not depend upon bugs in the pthreads implementation for proper
operation of the regression test. This test will now fail until I commit the 'send signals to only one thread bug' change.
Diffstat (limited to 'regress/lib/libpthread')
-rw-r--r--regress/lib/libpthread/sigwait/sigwait.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/regress/lib/libpthread/sigwait/sigwait.c b/regress/lib/libpthread/sigwait/sigwait.c
index 70ed4f576cc..b83a3552c51 100644
--- a/regress/lib/libpthread/sigwait/sigwait.c
+++ b/regress/lib/libpthread/sigwait/sigwait.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sigwait.c,v 1.2 2001/11/11 23:26:35 deraadt Exp $ */
+/* $OpenBSD: sigwait.c,v 1.3 2002/10/12 03:00:11 marc Exp $ */
/*
* Copyright (c) 1998 Daniel M. Eischen <eischen@vigrid.com>
* All rights reserved.
@@ -52,14 +52,11 @@ static void *
sigwaiter (void *arg)
{
int signo;
- sigset_t mask;
SET_NAME("sigwaiter");
- /* Block SIGHUP */
- sigemptyset (&mask);
- sigaddset (&mask, SIGHUP);
- CHECKe(sigprocmask (SIG_BLOCK, &mask, NULL));
+ /* Block all of the signals that the function will wait for */
+ CHECKe(sigprocmask (SIG_BLOCK, &wait_mask, NULL));
while (sigcounts[SIGINT] == 0) {
printf("Sigwait waiting (thread %p)\n", pthread_self());
@@ -219,7 +216,7 @@ int main (int argc, char *argv[])
/* Release the waiter from sigwait. */
CHECKe(kill(getpid(), SIGHUP));
sleep (1);
- /* sigwait should wake up for SIGHUP */
+ /* signal handler should wake up for SIGHUP */
ASSERT(sigcounts[SIGHUP] == 1);
/*
* Add SIGHUP to all threads pending signals. Since there is
@@ -231,8 +228,11 @@ int main (int argc, char *argv[])
/* Release the waiter thread and allow him to run. */
CHECKr(pthread_mutex_unlock (&waiter_mutex));
sleep (1);
- /* sigwait should return for pending SIGHUP */
- ASSERT(sigcounts[SIGHUP] == 3);
+ /*
+ * sigwait should NOT return for pending SIGHUP. Nothing is pending
+ * because the signal was processed by the SIGHUP signal handler.
+ */
+ ASSERT(sigcounts[SIGHUP] == 2);
/*
* Repeat the above test using pthread_kill and SIGUSR1
@@ -244,7 +244,7 @@ int main (int argc, char *argv[])
sleep (1);
/* sigwait should wake up for SIGUSR1 */
ASSERT(sigcounts[SIGUSR1] == 1);
- /* Add SIGHUP to the waiters pending signals. */
+ /* Add SIGUSR1 to the waiters pending signals. */
CHECKr(pthread_kill (tid, SIGUSR1));
/* Release the waiter thread and allow him to run. */
CHECKe(pthread_mutex_unlock (&waiter_mutex));