[compiler-rt] r235294 - tsan: deflake a test
Dmitry Vyukov
dvyukov at google.com
Mon Apr 20 03:35:21 PDT 2015
Author: dvyukov
Date: Mon Apr 20 05:35:21 2015
New Revision: 235294
URL: http://llvm.org/viewvc/llvm-project?rev=235294&view=rev
Log:
tsan: deflake a test
Modified:
compiler-rt/trunk/test/tsan/java_race.cc
Modified: compiler-rt/trunk/test/tsan/java_race.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/tsan/java_race.cc?rev=235294&r1=235293&r2=235294&view=diff
==============================================================================
--- compiler-rt/trunk/test/tsan/java_race.cc (original)
+++ compiler-rt/trunk/test/tsan/java_race.cc Mon Apr 20 05:35:21 2015
@@ -2,11 +2,13 @@
#include "java.h"
void *Thread(void *p) {
+ barrier_wait(&barrier);
*(int*)p = 42;
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
int const kHeapSize = 1024 * 1024;
jptr jheap = (jptr)malloc(kHeapSize + 8) + 8;
__tsan_java_init(jheap, kHeapSize);
@@ -15,6 +17,7 @@ int main() {
pthread_t th;
pthread_create(&th, 0, Thread, (void*)jheap);
*(int*)jheap = 43;
+ barrier_wait(&barrier);
pthread_join(th, 0);
__tsan_java_free(jheap, kBlockSize);
fprintf(stderr, "DONE\n");
More information about the llvm-commits
mailing list