diff options
Diffstat (limited to 'test/tsan/fd_pipe_race.cc')
-rw-r--r-- | test/tsan/fd_pipe_race.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/tsan/fd_pipe_race.cc b/test/tsan/fd_pipe_race.cc index 88c4ed4aa398..b94893b93691 100644 --- a/test/tsan/fd_pipe_race.cc +++ b/test/tsan/fd_pipe_race.cc @@ -1,23 +1,23 @@ // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s -#include <pthread.h> -#include <stdio.h> -#include <unistd.h> +#include "test.h" int fds[2]; void *Thread1(void *x) { write(fds[1], "a", 1); + barrier_wait(&barrier); return NULL; } void *Thread2(void *x) { - sleep(1); + barrier_wait(&barrier); close(fds[0]); close(fds[1]); return NULL; } int main() { + barrier_init(&barrier, 2); pipe(fds); pthread_t t[2]; pthread_create(&t[0], NULL, Thread1, NULL); |