bart | c844150 | 2009-07-27 16:03:51 +0000 | [diff] [blame^] | 1 | /** |
| 2 | * @file rwlock_type_checking.c |
| 3 | * |
| 4 | * @brief Test whether DRD reports attempts to use a user-defined rwlock as |
| 5 | * a POSIX rwlock and vice versa. |
| 6 | */ |
| 7 | |
| 8 | |
| 9 | #define _GNU_SOURCE 1 |
| 10 | |
| 11 | #include <pthread.h> |
| 12 | #include <stdio.h> |
| 13 | #include "../../config.h" |
| 14 | #include "../../drd/drd.h" |
| 15 | |
| 16 | |
| 17 | int main(int argc, char** argv) |
| 18 | { |
| 19 | pthread_rwlock_t posix_rwlock; |
| 20 | int user_defined_rwlock; |
| 21 | |
| 22 | ANNOTATE_RWLOCK_CREATE(&user_defined_rwlock); |
| 23 | pthread_rwlock_init(&posix_rwlock, 0); |
| 24 | |
| 25 | pthread_rwlock_rdlock((pthread_rwlock_t*)&user_defined_rwlock); |
| 26 | |
| 27 | ANNOTATE_READERLOCK_ACQUIRED(&posix_rwlock); |
| 28 | |
| 29 | pthread_rwlock_destroy(&posix_rwlock); |
| 30 | ANNOTATE_RWLOCK_DESTROY(&user_defined_rwlock); |
| 31 | |
| 32 | fprintf(stderr, "Finished.\n"); |
| 33 | |
| 34 | return 0; |
| 35 | } |