diff options
Diffstat (limited to 'compiler-rt/test/tsan/race_on_barrier.c')
-rw-r--r-- | compiler-rt/test/tsan/race_on_barrier.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/compiler-rt/test/tsan/race_on_barrier.c b/compiler-rt/test/tsan/race_on_barrier.c index 99b18fe4d8e..cf8a4cb9927 100644 --- a/compiler-rt/test/tsan/race_on_barrier.c +++ b/compiler-rt/test/tsan/race_on_barrier.c @@ -1,25 +1,24 @@ // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s -#include <pthread.h> -#include <stdio.h> -#include <stddef.h> -#include <unistd.h> +#include "test.h" pthread_barrier_t B; int Global; void *Thread1(void *x) { pthread_barrier_init(&B, 0, 2); + barrier_wait(&barrier); pthread_barrier_wait(&B); return NULL; } void *Thread2(void *x) { - sleep(1); + barrier_wait(&barrier); pthread_barrier_wait(&B); return NULL; } int main() { + barrier_init(&barrier, 2); pthread_t t; pthread_create(&t, NULL, Thread1, NULL); Thread2(0); |