1 // RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
2 // CHECK-NOT: WARNING: ThreadSanitizer: data race
3 // CHECK-NOT: ThreadSanitizer WARNING: double lock
4 // CHECK-NOT: ThreadSanitizer WARNING: mutex unlock by another thread
18 for (i
= 0; i
< 10; i
+= 2) {
19 pthread_mutex_lock(&m
);
21 pthread_cond_wait(&c
, &m
);
23 pthread_cond_signal(&c
);
24 pthread_mutex_unlock(&m
);
32 for (i
= 1; i
< 10; i
+= 2) {
33 pthread_mutex_lock(&m
);
35 pthread_cond_wait(&c
, &m
);
37 pthread_mutex_unlock(&m
);
38 pthread_cond_broadcast(&c
);
46 pthread_mutex_init(&m
, 0);
47 pthread_cond_init(&c
, 0);
48 pthread_create(&th1
, 0, thr1
, 0);
49 pthread_create(&th2
, 0, thr2
, 0);
52 fprintf(stderr
, "OK\n");