summaryrefslogtreecommitdiff
path: root/rt/tst-mqueue5.c
diff options
context:
space:
mode:
Diffstat (limited to 'rt/tst-mqueue5.c')
-rw-r--r--rt/tst-mqueue5.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/rt/tst-mqueue5.c b/rt/tst-mqueue5.c
index 6000f72878..25042bcc9f 100644
--- a/rt/tst-mqueue5.c
+++ b/rt/tst-mqueue5.c
@@ -1,5 +1,5 @@
/* Test mq_notify.
- Copyright (C) 2004-2015 Free Software Foundation, Inc.
+ Copyright (C) 2004-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Jakub Jelinek <jakub@redhat.com>, 2004.
@@ -116,7 +116,7 @@ thr (void *arg)
if (rtmin_cnt != 2)
{
- puts ("SIGRTMIN signal in child did not arrive");
+ puts ("SIGRTMIN signal in thread did not arrive");
result = 1;
}
else if (rtmin_pid != getppid ()
@@ -403,6 +403,16 @@ do_child (const char *name, pthread_barrier_t *b2, pthread_barrier_t *b3,
result = 1;
}
+ /* Ensure the thr thread gets the signal, not us. */
+ sigset_t set;
+ sigemptyset (&set);
+ sigaddset (&set, SIGRTMIN);
+ if (pthread_sigmask (SIG_BLOCK, &set, NULL))
+ {
+ printf ("Failed to block SIGRTMIN in child: %m\n");
+ result = 1;
+ }
+
(void) pthread_barrier_wait (b2);
/* Parent calls mqsend (q), which should wake up mqrecv (q)
@@ -514,7 +524,14 @@ do_child (const char *name, pthread_barrier_t *b2, pthread_barrier_t *b3,
result = 1;
}
- void *thr_ret;
+ /* Reenable test signals before cleaning up the thread. */
+ if (pthread_sigmask (SIG_UNBLOCK, &set, NULL))
+ {
+ printf ("Failed to unblock SIGRTMIN in child: %m\n");
+ result = 1;
+ }
+
+ void *thr_ret;
ret = pthread_join (th, &thr_ret);
if (ret)
{