blob: 2b3dcb012e506502e23fdf71f03e350ba7e9122b [file] [log] [blame]
Stephen Hines2d1fdb22014-05-28 23:58:16 -07001// RUN: %clangxx_tsan %s -o %t
2// RUN: %run %t 2>&1 | FileCheck %s
3
Pirama Arumuga Nainar799172d2016-03-03 15:50:30 -08004// bench.h needs pthread barriers which are not available on OS X
5// UNSUPPORTED: darwin
6
Stephen Hines2d1fdb22014-05-28 23:58:16 -07007#include "bench.h"
8
9pthread_rwlock_t mtx;
10
11void thread(int tid) {
12 for (int i = 0; i < bench_niter; i++) {
13 pthread_rwlock_rdlock(&mtx);
14 pthread_rwlock_unlock(&mtx);
15 }
16}
17
18void 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);
25}
26
27// CHECK: DONE
28