Home | History | Annotate | Download | only in tsan
      1 // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
      2 #include "test.h"
      3 
      4 int Global;
      5 
      6 void *Thread1(void *x) {
      7   barrier_wait(&barrier);
      8   Global = 42;
      9   return x;
     10 }
     11 
     12 int main() {
     13   barrier_init(&barrier, 2);
     14   pthread_t t;
     15   pthread_create(&t, 0, Thread1, 0);
     16   Global = 43;
     17   barrier_wait(&barrier);
     18   pthread_join(t, 0);
     19   return Global;
     20 }
     21 
     22 // CHECK: WARNING: ThreadSanitizer: data race
     23