diff options
Diffstat (limited to 'lib/tsan/lit_tests/tiny_race.c')
-rw-r--r-- | lib/tsan/lit_tests/tiny_race.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/tsan/lit_tests/tiny_race.c b/lib/tsan/lit_tests/tiny_race.c index 44cc1332f2ab..f77e1606c1dd 100644 --- a/lib/tsan/lit_tests/tiny_race.c +++ b/lib/tsan/lit_tests/tiny_race.c @@ -1,15 +1,21 @@ -// RUN: %clang_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s +// RUN: %clang_tsan -O1 %s -o %t && not %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 |