1 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
7 pthread_mutex_init(&m, 0);
8 pthread_cond_init(&c, 0);
14 pthread_mutex_lock(&m);
16 pthread_cond_signal(&c);
17 pthread_mutex_unlock(&m);
30 pthread_mutex_lock(&m);
32 pthread_cond_wait(&c, &m);
33 pthread_mutex_unlock(&m);
37 static A *obj = new B;
39 void *Thread1(void *x) {
45 void *Thread2(void *x) {
52 pthread_create(&t[0], NULL, Thread1, NULL);
53 pthread_create(&t[1], NULL, Thread2, NULL);
54 pthread_join(t[0], NULL);
55 pthread_join(t[1], NULL);
56 fprintf(stderr, "PASS\n");
59 // CHECK-NOT: WARNING: ThreadSanitizer: data race