1 #include <pthread.h> 2 #include <stdio.h> 3 4 int Global; 5 6 void *Thread1(void *x) { 7 Global++; 8 return NULL; 9 } 10 11 void *Thread2(void *x) { 12 Global--; 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 } 23 24 // CHECK: WARNING: ThreadSanitizer: data race 25