diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-05-31 08:56:14 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-05-31 08:56:14 +0000 |
commit | 10bb97c7933700d5ca3b596c67d59ee944774d88 (patch) | |
tree | 124d2f3b06a537c99719f331a60a04607d362cac /nptl | |
parent | e4d6e7f5c0e85084fd153a2eb86a3ced65ea0b5a (diff) | |
download | glibc-10bb97c7933700d5ca3b596c67d59ee944774d88.tar.gz glibc-10bb97c7933700d5ca3b596c67d59ee944774d88.tar.xz glibc-10bb97c7933700d5ca3b596c67d59ee944774d88.zip |
(tests): Add tst-rwlock2a.
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/Makefile | 6 | ||||
-rw-r--r-- | nptl/tst-rwlock2.c | 28 | ||||
-rw-r--r-- | nptl/tst-rwlock2a.c | 2 |
3 files changed, 32 insertions, 4 deletions
diff --git a/nptl/Makefile b/nptl/Makefile index a55d7f5e92..7b44b2ec63 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -210,9 +210,9 @@ tests = tst-typesizes \ tst-robust6 tst-robust7 tst-robust8 tst-robust9 \ tst-robustpi1 tst-robustpi2 tst-robustpi3 tst-robustpi4 tst-robustpi5 \ tst-robustpi6 tst-robustpi7 tst-robustpi8 tst-robustpi9 \ - tst-rwlock1 tst-rwlock2 tst-rwlock3 tst-rwlock4 tst-rwlock5 \ - tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 tst-rwlock10 \ - tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \ + tst-rwlock1 tst-rwlock2 tst-rwlock2a tst-rwlock3 tst-rwlock4 \ + tst-rwlock5 tst-rwlock6 tst-rwlock7 tst-rwlock8 tst-rwlock9 \ + tst-rwlock10 tst-rwlock11 tst-rwlock12 tst-rwlock13 tst-rwlock14 \ tst-once1 tst-once2 tst-once3 tst-once4 \ tst-key1 tst-key2 tst-key3 tst-key4 \ tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \ 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"); diff --git a/nptl/tst-rwlock2a.c b/nptl/tst-rwlock2a.c new file mode 100644 index 0000000000..615de5c015 --- /dev/null +++ b/nptl/tst-rwlock2a.c @@ -0,0 +1,2 @@ +#define TYPE PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP +#include "tst-rwlock2.c" |