summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/tsan/stack_race.cc
diff options
context:
space:
mode:
Diffstat (limited to 'compiler-rt/test/tsan/stack_race.cc')
-rw-r--r--compiler-rt/test/tsan/stack_race.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler-rt/test/tsan/stack_race.cc b/compiler-rt/test/tsan/stack_race.cc
index 2e02f46a281..1ada2953547 100644
--- a/compiler-rt/test/tsan/stack_race.cc
+++ b/compiler-rt/test/tsan/stack_race.cc
@@ -1,19 +1,19 @@
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
-#include <pthread.h>
-#include <stddef.h>
-#include <unistd.h>
+#include "test.h"
void *Thread(void *a) {
- sleep(1);
+ barrier_wait(&barrier);
*(int*)a = 43;
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
int Var = 42;
pthread_t t;
pthread_create(&t, 0, Thread, &Var);
Var = 43;
+ barrier_wait(&barrier);
pthread_join(t, 0);
}
OpenPOWER on IntegriCloud