Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / bench_rwmutex.cpp
blob2b3dcb012e506502e23fdf71f03e350ba7e9122b
1 // RUN: %clangxx_tsan %s -o %t
2 // RUN: %run %t 2>&1 | FileCheck %s
4 // bench.h needs pthread barriers which are not available on OS X
5 // UNSUPPORTED: darwin
7 #include "bench.h"
9 pthread_rwlock_t mtx;
11 void thread(int tid) {
12 for (int i = 0; i < bench_niter; i++) {
13 pthread_rwlock_rdlock(&mtx);
14 pthread_rwlock_unlock(&mtx);
18 void bench() {
19 pthread_rwlock_init(&mtx, 0);
20 pthread_rwlock_wrlock(&mtx);
21 pthread_rwlock_unlock(&mtx);
22 pthread_rwlock_rdlock(&mtx);
23 pthread_rwlock_unlock(&mtx);
24 start_thread_group(bench_nthread, thread);
27 // CHECK: DONE