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