summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/tsan/vptr_harmful_race.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test/tsan/vptr_harmful_race.cc')
-rw-r--r--compiler-rt/test/tsan/vptr_harmful_race.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler-rt/test/tsan/vptr_harmful_race.cc b/compiler-rt/test/tsan/vptr_harmful_race.cc
index 68e12e8e7e8..d15b3969ab8 100644
--- a/compiler-rt/test/tsan/vptr_harmful_race.cc
+++ b/compiler-rt/test/tsan/vptr_harmful_race.cc
@@ -1,8 +1,6 @@
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
-#include <pthread.h>
+#include "test.h"
#include <semaphore.h>
-#include <stdio.h>
-#include <unistd.h>
struct A {
A() {
@@ -31,16 +29,18 @@ static A *obj = new B;
void *Thread1(void *x) {
obj->F();
obj->Done();
+ barrier_wait(&barrier);
return NULL;
}
void *Thread2(void *x) {
- sleep(1);
+ barrier_wait(&barrier);
delete obj;
return NULL;
}
int main() {
+ barrier_init(&barrier, 2);
pthread_t t[2];
pthread_create(&t[0], NULL, Thread1, NULL);
pthread_create(&t[1], NULL, Thread2, NULL);
OpenPOWER on IntegriCloud