1 #include <pthread.h> 2 #include <stdio.h> 3 #include <stddef.h> 4 5 void *Thread(void *a) { 6 ((int*)a)[0]++; 7 return NULL; 8 } 9 10 int main() { 11 int *p = new int(42); 12 pthread_t t; 13 pthread_create(&t, NULL, Thread, p); 14 p[0]++; 15 pthread_join(t, NULL); 16 delete p; 17 } 18 19 // CHECK: WARNING: ThreadSanitizer: data race 20