Home | History | Annotate | Download | only in output_tests
      1 #include <pthread.h>
      2 #include <stdio.h>
      3 
      4 int Global;
      5 
      6 void *Thread1(void *x) {
      7   Global = 42;
      8   return NULL;
      9 }
     10 
     11 void *Thread2(void *x) {
     12   Global = 43;
     13   return NULL;
     14 }
     15 
     16 int main() {
     17   pthread_t t[2];
     18   pthread_create(&t[0], NULL, Thread1, NULL);
     19   pthread_create(&t[1], NULL, Thread2, NULL);
     20   pthread_join(t[0], NULL);
     21   pthread_join(t[1], NULL);
     22   return 0;
     23 }
     24 
     25 // CHECK: WARNING: ThreadSanitizer: data race
     26