aboutsummaryrefslogtreecommitdiff
path: root/test/tsan/fd_location.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/tsan/fd_location.cc')
-rw-r--r--test/tsan/fd_location.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/tsan/fd_location.cc b/test/tsan/fd_location.cc
index 535329e06409..1861c89cba9b 100644
--- a/test/tsan/fd_location.cc
+++ b/test/tsan/fd_location.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);