summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/tsan/lit_tests/tiny_race.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/compiler-rt/lib/tsan/lit_tests/tiny_race.c b/compiler-rt/lib/tsan/lit_tests/tiny_race.c
index 44cc1332f2a..1ade8e2bf52 100644
--- a/compiler-rt/lib/tsan/lit_tests/tiny_race.c
+++ b/compiler-rt/lib/tsan/lit_tests/tiny_race.c
@@ -1,15 +1,21 @@
// RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s
#include <pthread.h>
+#include <unistd.h>
+
int Global;
+
void *Thread1(void *x) {
+ sleep(1);
Global = 42;
return x;
}
+
int main() {
pthread_t t;
- pthread_create(&t, NULL, Thread1, NULL);
+ pthread_create(&t, 0, Thread1, 0);
Global = 43;
- pthread_join(t, NULL);
+ pthread_join(t, 0);
return Global;
}
+
// CHECK: WARNING: ThreadSanitizer: data race
OpenPOWER on IntegriCloud