Home | History | Annotate | Download | only in output_tests
      1 #include <pthread.h>
      2 #include <unistd.h>
      3 
      4 int X = 0;
      5 
      6 void *Thread(void *p) {
      7   X = 42;
      8   return 0;
      9 }
     10 
     11 int main() {
     12   pthread_t t;
     13   usleep(100*1000);
     14   pthread_create(&t, 0, Thread, 0);
     15   X = 43;
     16   pthread_join(t, 0);
     17   return 0;
     18 }
     19 
     20 // CHECK: WARNING: ThreadSanitizer: data race
     21 // CHECK-NOT: As if synchronized via sleep
     22