aboutsummaryrefslogtreecommitdiff
path: root/test/tsan/race_on_puts.cc
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-02-10 07:45:43 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-02-10 07:45:43 +0000
commit476c4db3dc56bee43df384704c75ccc71cfa7a1d (patch)
tree5d0dcec3cc12fc53532fc84029892b98711a2596 /test/tsan/race_on_puts.cc
parentca9211ecdede9bdedb812b2243a4abdb8dacd1b9 (diff)
downloadsrc-476c4db3dc56bee43df384704c75ccc71cfa7a1d.tar.gz
src-476c4db3dc56bee43df384704c75ccc71cfa7a1d.zip
Import compiler-rt trunk r228651.vendor/compiler-rt/compiler-rt-r228651
Notes
Notes: svn path=/vendor/compiler-rt/dist/; revision=278497 svn path=/vendor/compiler-rt/compiler-rt-r228651/; revision=278498; tag=vendor/compiler-rt/compiler-rt-r228651
Diffstat (limited to 'test/tsan/race_on_puts.cc')
-rw-r--r--test/tsan/race_on_puts.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/test/tsan/race_on_puts.cc b/test/tsan/race_on_puts.cc
index 1f2b4db836ed..f2541823bf0c 100644
--- a/test/tsan/race_on_puts.cc
+++ b/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);