Home | History | Annotate | Download | only in tsan
      1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
      2 #include <pthread.h>
      3 #include <unistd.h>
      4 
      5 volatile int X;
      6 
      7 void *Thread1(void *x) {
      8   sleep(1);
      9   X = 42;
     10   X = 66;
     11   X = 78;
     12   return 0;
     13 }
     14 
     15 void *Thread2(void *x) {
     16   X = 11;
     17   X = 99;
     18   X = 73;
     19   return 0;
     20 }
     21 
     22 int main() {
     23   pthread_t t;
     24   pthread_create(&t, 0, Thread1, 0);
     25   Thread2(0);
     26   pthread_join(t, 0);
     27 }
     28 
     29 // CHECK: ThreadSanitizer: reported 1 warnings
     30