summary refs log tree commit diff
path: root/nptl/tst-rwlock2.c
diff options
context:
space:
mode:
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 6f38682b85..2d2e8e4a3e 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");