summaryrefslogtreecommitdiff
path: root/nptl/tst-robust7.c
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/tst-robust7.c')
-rw-r--r--nptl/tst-robust7.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/nptl/tst-robust7.c b/nptl/tst-robust7.c
index 2c5acb44ce..d0bc91cc8e 100644
--- a/nptl/tst-robust7.c
+++ b/nptl/tst-robust7.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2005.
@@ -95,8 +95,25 @@ do_test (void)
return 1;
}
- if (pthread_mutex_init (&m, &a) != 0)
+#ifdef ENABLE_PI
+ if (pthread_mutexattr_setprotocol (&a, PTHREAD_PRIO_INHERIT) != 0)
{
+ puts ("pthread_mutexattr_setprotocol failed");
+ return 1;
+ }
+#endif
+
+ int e;
+ e = pthread_mutex_init (&m, &a);
+ if (e != 0)
+ {
+#ifdef ENABLE_PI
+ if (e == ENOTSUP)
+ {
+ puts ("PI robust mutexes not supported");
+ return 0;
+ }
+#endif
puts ("mutex_init failed");
return 1;
}
@@ -123,7 +140,7 @@ do_test (void)
return 1;
}
- int e = pthread_barrier_wait (&b);
+ e = pthread_barrier_wait (&b);
if (e != 0 && e != PTHREAD_BARRIER_SERIAL_THREAD)
{
printf ("parent: barrier_wait failed in round %ld\n", n + 1);
@@ -164,7 +181,7 @@ do_test (void)
}
}
- int e = pthread_mutex_lock (&m);
+ e = pthread_mutex_lock (&m);
if (e == 0)
{
puts ("parent: 2nd mutex_lock succeeded");