1 // RUN: %clangxx_tsan %s -o %t
2 // RUN: %run %t 2>&1 | FileCheck %s
10 void thread(int tid
) {
11 for (int i
= 0; i
< bench_niter
; i
++) {
12 pthread_mutex_lock(&mtx
);
13 while (x
!= i
* 2 + tid
)
14 pthread_cond_wait(&cv
, &mtx
);
16 pthread_cond_signal(&cv
);
17 pthread_mutex_unlock(&mtx
);
22 pthread_mutex_init(&mtx
, 0);
23 pthread_cond_init(&cv
, 0);
24 start_thread_group(2, thread
);