aboutsummaryrefslogtreecommitdiff
path: root/test/tsan/halt_on_error.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/tsan/halt_on_error.cc')
-rw-r--r--test/tsan/halt_on_error.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/tsan/halt_on_error.cc b/test/tsan/halt_on_error.cc
index 3c55c60a457e..e55454b57c1d 100644
--- a/test/tsan/halt_on_error.cc
+++ b/test/tsan/halt_on_error.cc
@@ -1,21 +1,21 @@
// RUN: %clang_tsan -O1 %s -o %t && TSAN_OPTIONS="$TSAN_OPTIONS halt_on_error=1" %deflake %run %t | FileCheck %s
-#include <pthread.h>
-#include <stdio.h>
-#include <unistd.h>
+#include "test.h"
int X;
void *Thread(void *x) {
- sleep(1);
+ barrier_wait(&barrier);
X = 42;
return 0;
}
int main() {
+ barrier_init(&barrier, 2);
fprintf(stderr, "BEFORE\n");
pthread_t t;
pthread_create(&t, 0, Thread, 0);
X = 43;
+ barrier_wait(&barrier);
pthread_join(t, 0);
fprintf(stderr, "AFTER\n");
return 0;