-> 3.17.0.RC2
[valgrind.git] / drd / tests / rwlock_type_checking.c
blobe4697afd5d8a8dac15abdccf11d31bdd2143e8e7
1 /**
2 * @file rwlock_type_checking.c
4 * @brief Test whether DRD reports attempts to use a user-defined rwlock as
5 * a POSIX rwlock and vice versa.
6 */
9 #define _GNU_SOURCE 1
11 #include <pthread.h>
12 #include <stdio.h>
13 #include <string.h>
14 #include "../../config.h"
15 #include "../../drd/drd.h"
18 int main(int argc, char** argv)
20 pthread_rwlock_t posix_rwlock;
21 pthread_rwlock_t user_defined_rwlock;
23 memset(&user_defined_rwlock, 0, sizeof(user_defined_rwlock));
24 ANNOTATE_RWLOCK_CREATE(&user_defined_rwlock);
25 pthread_rwlock_init(&posix_rwlock, 0);
27 pthread_rwlock_init((pthread_rwlock_t*)&user_defined_rwlock, 0);
29 ANNOTATE_READERLOCK_RELEASED(&posix_rwlock);
31 pthread_rwlock_destroy(&posix_rwlock);
32 ANNOTATE_RWLOCK_DESTROY(&user_defined_rwlock);
34 fprintf(stderr, "Finished.\n");
36 return 0;