2 /* Needed for older glibcs (2.3 and older, at least) who don't
3 otherwise "know" about pthread_rwlock_anything or about
4 PTHREAD_MUTEX_RECURSIVE (amongst things). */
8 #include "safe-pthread.h"
11 /* Do trivial stuff with a reader-writer lock. */
18 r
= pthread_rwlock_init( &rwl
, NULL
); assert(r
== 0);
20 r
= pthread_rwlock_wrlock( &rwl
); assert(r
== 0);
21 r
= pthread_rwlock_unlock( &rwl
); assert(r
== 0);
23 r
= pthread_rwlock_rdlock( &rwl
); assert(r
== 0);
24 r
= pthread_rwlock_rdlock( &rwl
); assert(r
== 0);
25 r
= pthread_rwlock_unlock( &rwl
); assert(r
== 0);
26 r
= pthread_rwlock_unlock( &rwl
); assert(r
== 0);
28 /* this should fail - lock is unowned now */
29 r
= pthread_rwlock_unlock( &rwl
);
30 #if defined(VGO_darwin) || defined(VGO_solaris)
36 r
= pthread_rwlock_destroy( &rwl
); assert(r
== 0);