diff options
Diffstat (limited to 'test/tsan/vptr_harmful_race3.cc')
-rw-r--r-- | test/tsan/vptr_harmful_race3.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/tsan/vptr_harmful_race3.cc b/test/tsan/vptr_harmful_race3.cc index ac6ea94e51eb..3810a1068d64 100644 --- a/test/tsan/vptr_harmful_race3.cc +++ b/test/tsan/vptr_harmful_race3.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() { @@ -30,18 +28,20 @@ static A *obj = new B; static void (A::*fn)() = &A::F; void *Thread1(void *x) { - sleep(1); (obj->*fn)(); + barrier_wait(&barrier); obj->Done(); return NULL; } void *Thread2(void *x) { + 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); |