summaryrefslogtreecommitdiff
path: root/test/tsan/vptr_harmful_race4.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/tsan/vptr_harmful_race4.cc')
-rw-r--r--test/tsan/vptr_harmful_race4.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/tsan/vptr_harmful_race4.cc b/test/tsan/vptr_harmful_race4.cc
index 969c9d58a..543514de8 100644
--- a/test/tsan/vptr_harmful_race4.cc
+++ b/test/tsan/vptr_harmful_race4.cc
@@ -1,7 +1,5 @@
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
+#include "test.h"
struct A {
virtual void F() {
@@ -17,16 +15,18 @@ struct B : A {
};
void *Thread(void *x) {
- sleep(1);
+ barrier_wait(&barrier);
((A*)x)->F();
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
A *obj = new B;
pthread_t t;
pthread_create(&t, 0, Thread, obj);
delete obj;
+ barrier_wait(&barrier);
pthread_join(t, 0);
}