diff options
Diffstat (limited to 'test/tsan/fork_deadlock.cc')
-rw-r--r-- | test/tsan/fork_deadlock.cc | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/test/tsan/fork_deadlock.cc b/test/tsan/fork_deadlock.cc index cc5b12214cf9..9418800bd336 100644 --- a/test/tsan/fork_deadlock.cc +++ b/test/tsan/fork_deadlock.cc @@ -1,9 +1,6 @@ // RUN: %clangxx_tsan -O1 %s -o %t && TSAN_OPTIONS="atexit_sleep_ms=50" %run %t 2>&1 | FileCheck %s -#include <stdlib.h> -#include <stdio.h> +#include "test.h" #include <errno.h> -#include <pthread.h> -#include <unistd.h> #include <sys/types.h> #include <sys/wait.h> @@ -16,13 +13,14 @@ static void *incrementer(void *p) { } static void *watchdog(void *p) { - sleep(100); + sleep(100); // is not intended to exit fprintf(stderr, "timed out after 100 seconds\n"); exit(1); return 0; } int main() { + barrier_init(&barrier, 2); pthread_t th1, th2; pthread_create(&th1, 0, incrementer, 0); pthread_create(&th2, 0, watchdog, 0); |