1 #define _XOPEN_SOURCE 600
2 
3 #include <pthread.h>
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 
8 #define LOCKS 2000
9 
10 int main(int argc, char **argv)
11 {
12   pthread_rwlock_t locks[LOCKS];
13   int n;
14   int e;
15 
16   for (n = 0; n < LOCKS; n++) {
17     if ((e = pthread_rwlock_init(locks + n, NULL)) != 0) {
18       fprintf(stderr, "pthread_rwlock_init[%d]: %s\n", n, strerror(e));
19       exit(1);
20     }
21   }
22 
23   for (n = 0; n < LOCKS; n++) {
24     if ((e = pthread_rwlock_destroy(locks + n)) != 0) {
25       fprintf(stderr, "pthread_rwlock_destroy[%d]: %s\n", n, strerror(e));
26       exit(1);
27     }
28   }
29 
30   exit(0);
31 }
32