summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/tsan/race_on_puts.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test/tsan/race_on_puts.cc')
-rw-r--r--compiler-rt/test/tsan/race_on_puts.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler-rt/test/tsan/race_on_puts.cc b/compiler-rt/test/tsan/race_on_puts.cc
index 1f2b4db836e..f2541823bf0 100644
--- a/compiler-rt/test/tsan/race_on_puts.cc
+++ b/compiler-rt/test/tsan/race_on_puts.cc
@@ -1,21 +1,22 @@
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
+#include "test.h"
char s[] = "abracadabra";
void *Thread0(void *p) {
puts(s);
+ barrier_wait(&barrier);
return 0;
}
void *Thread1(void *p) {
+ barrier_wait(&barrier);
s[3] = 'z';
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
pthread_t th[2];
pthread_create(&th[0], 0, Thread0, 0);
pthread_create(&th[1], 0, Thread1, 0);
OpenPOWER on IntegriCloud