diff options
Diffstat (limited to 'compiler-rt/test/tsan/simple_race.c')
-rw-r--r-- | compiler-rt/test/tsan/simple_race.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/compiler-rt/test/tsan/simple_race.c b/compiler-rt/test/tsan/simple_race.c index 7b60c5ec249..b4234acd7f8 100644 --- a/compiler-rt/test/tsan/simple_race.c +++ b/compiler-rt/test/tsan/simple_race.c @@ -1,22 +1,22 @@ // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s -#include <pthread.h> -#include <stdio.h> -#include <unistd.h> +#include "test.h" int Global; void *Thread1(void *x) { - sleep(1); + barrier_wait(&barrier); Global = 42; return NULL; } void *Thread2(void *x) { Global = 43; + barrier_wait(&barrier); return NULL; } int main() { + barrier_init(&barrier, 2); pthread_t t[2]; pthread_create(&t[0], NULL, Thread1, NULL); pthread_create(&t[1], NULL, Thread2, NULL); |