1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
4 void *Thread(void *p
) {
5 barrier_wait(&barrier
);
11 barrier_init(&barrier
, 2);
12 int const kHeapSize
= 1024 * 1024;
13 jptr jheap
= (jptr
)malloc(kHeapSize
+ 8) + 8;
14 __tsan_java_init(jheap
, kHeapSize
);
15 const int kBlockSize
= 16;
16 __tsan_java_alloc(jheap
, kBlockSize
);
18 pthread_create(&th
, 0, Thread
, (void*)jheap
);
20 barrier_wait(&barrier
);
22 __tsan_java_free(jheap
, kBlockSize
);
23 fprintf(stderr
, "DONE\n");
24 return __tsan_java_fini();
27 // CHECK: WARNING: ThreadSanitizer: data race