summaryrefslogtreecommitdiff
path: root/test/tsan/heap_race.cc
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2015-05-14 20:27:12 +0000
committerKostya Serebryany <kcc@google.com>2015-05-14 20:27:12 +0000
commit0a93a02dc42d75bad5b7c7dad975a488e2833fcc (patch)
treebd4702b44989df7ff197561d5b3f00aece56bd54 /test/tsan/heap_race.cc
parent821c7c514f2a537db88646cca927d308c1961b52 (diff)
[tsan] deflakify one more tsan test
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@237387 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/tsan/heap_race.cc')
-rw-r--r--test/tsan/heap_race.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/tsan/heap_race.cc b/test/tsan/heap_race.cc
index c3da68f42..0201ea9a2 100644
--- a/test/tsan/heap_race.cc
+++ b/test/tsan/heap_race.cc
@@ -1,17 +1,21 @@
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
+#include "test.h"
#include <pthread.h>
#include <stdio.h>
#include <stddef.h>
void *Thread(void *a) {
((int*)a)[0]++;
+ barrier_wait(&barrier);
return NULL;
}
int main() {
+ barrier_init(&barrier, 2);
int *p = new int(42);
pthread_t t;
pthread_create(&t, NULL, Thread, p);
+ barrier_wait(&barrier);
p[0]++;
pthread_join(t, NULL);
delete p;