diff options
Diffstat (limited to 'test/tsan/mutexset7.cc')
-rw-r--r-- | test/tsan/mutexset7.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/tsan/mutexset7.cc b/test/tsan/mutexset7.cc index 12174844c799..d3a221d1b421 100644 --- a/test/tsan/mutexset7.cc +++ b/test/tsan/mutexset7.cc @@ -1,13 +1,11 @@ // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s -#include <pthread.h> -#include <stdio.h> -#include <unistd.h> +#include "test.h" int Global; __thread int huge[1024*1024]; void *Thread1(void *x) { - sleep(1); + barrier_wait(&barrier); Global++; return NULL; } @@ -20,10 +18,12 @@ void *Thread2(void *x) { pthread_mutex_unlock(mtx); pthread_mutex_destroy(mtx); delete mtx; + 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); |