aboutsummaryrefslogtreecommitdiff
path: root/nptl/tst-rwlock2.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-05-31 08:56:14 +0000
committerUlrich Drepper <drepper@redhat.com>2008-05-31 08:56:14 +0000
commit10bb97c7933700d5ca3b596c67d59ee944774d88 (patch)
tree124d2f3b06a537c99719f331a60a04607d362cac /nptl/tst-rwlock2.c
parente4d6e7f5c0e85084fd153a2eb86a3ced65ea0b5a (diff)
downloadglibc-10bb97c7933700d5ca3b596c67d59ee944774d88.zip
glibc-10bb97c7933700d5ca3b596c67d59ee944774d88.tar.gz
glibc-10bb97c7933700d5ca3b596c67d59ee944774d88.tar.bz2
(tests): Add tst-rwlock2a.
Diffstat (limited to 'nptl/tst-rwlock2.c')
-rw-r--r--nptl/tst-rwlock2.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/nptl/tst-rwlock2.c b/nptl/tst-rwlock2.c
index 6f38682..2d2e8e4 100644
--- a/nptl/tst-rwlock2.c
+++ b/nptl/tst-rwlock2.c
@@ -26,15 +26,41 @@ static int
do_test (void)
{
pthread_rwlock_t r;
+ pthread_rwlockattr_t at;
int e;
- if (pthread_rwlock_init (&r, NULL) != 0)
+ if (pthread_rwlockattr_init (&at) != 0)
+ {
+ puts ("rwlockattr_init failed");
+ return 1;
+ }
+ puts ("rwlockattr_init succeeded");
+
+#ifndef TYPE
+# define TYPE PTHREAD_RWLOCK_PREFER_READER_NP
+#endif
+
+ if (pthread_rwlockattr_setkind_np (&at, TYPE) != 0)
+ {
+ puts ("rwlockattr_setkind failed");
+ return 1;
+ }
+ puts ("rwlockattr_setkind succeeded");
+
+ if (pthread_rwlock_init (&r, &at) != 0)
{
puts ("rwlock_init failed");
return 1;
}
puts ("rwlock_init succeeded");
+ if (pthread_rwlockattr_destroy (&at) != 0)
+ {
+ puts ("rwlockattr_destroy failed");
+ return 1;
+ }
+ puts ("rwlockattr_destroy succeeded");
+
if (pthread_rwlock_wrlock (&r) != 0)
{
puts ("1st rwlock_wrlock failed");