Stephen Hines | 2d1fdb2 | 2014-05-28 23:58:16 -0700 | [diff] [blame] | 1 | // RUN: %clangxx_tsan %s -o %t |
| 2 | // RUN: %run %t 2>&1 | FileCheck %s |
| 3 | |
| 4 | #include "bench.h" |
| 5 | |
| 6 | pthread_rwlock_t mtx; |
| 7 | |
| 8 | void thread(int tid) { |
| 9 | for (int i = 0; i < bench_niter; i++) { |
| 10 | pthread_rwlock_rdlock(&mtx); |
| 11 | pthread_rwlock_unlock(&mtx); |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | void bench() { |
| 16 | pthread_rwlock_init(&mtx, 0); |
| 17 | pthread_rwlock_wrlock(&mtx); |
| 18 | pthread_rwlock_unlock(&mtx); |
| 19 | pthread_rwlock_rdlock(&mtx); |
| 20 | pthread_rwlock_unlock(&mtx); |
| 21 | start_thread_group(bench_nthread, thread); |
| 22 | } |
| 23 | |
| 24 | // CHECK: DONE |
| 25 | |