[Sanitizer] Add rudimentary support for wide-character strings to scanf/printf interc...
[blocksruntime.git] / test / tsan / bench_local_mutex.cc
blob3b656b7b00053a89fd6b636196ad9d1becef9629
1 // RUN: %clangxx_tsan %s -o %t
2 // RUN: %t 2>&1 | FileCheck %s
4 #include "bench.h"
6 pthread_mutex_t *mtx;
7 const int kStride = 16;
9 void thread(int tid) {
10 for (int i = 0; i < bench_niter; i++) {
11 pthread_mutex_lock(&mtx[tid * kStride]);
12 pthread_mutex_unlock(&mtx[tid * kStride]);
16 void bench() {
17 mtx = (pthread_mutex_t*)malloc(bench_nthread * kStride * sizeof(*mtx));
18 for (int i = 0; i < bench_nthread; i++) {
19 pthread_mutex_init(&mtx[i * kStride], 0);
20 pthread_mutex_lock(&mtx[i * kStride]);
21 pthread_mutex_unlock(&mtx[i * kStride]);
23 start_thread_group(bench_nthread, thread);
26 // CHECK: DONE