From 6b0110cdf045b64b448ae3488c75897eddf8f090 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Mon, 14 Apr 2014 12:14:17 -0600 Subject: [PATCH] gettime: handle pthread_create() failure Signed-off-by: Jens Axboe --- gettime.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gettime.c b/gettime.c index 98e83b85..d261e22e 100644 --- a/gettime.c +++ b/gettime.c @@ -560,7 +560,11 @@ int fio_monotonic_clocktest(void) pthread_mutex_init(&t->lock, NULL); pthread_mutex_init(&t->started, NULL); pthread_mutex_lock(&t->lock); - pthread_create(&t->thread, NULL, clock_thread_fn, t); + if (pthread_create(&t->thread, NULL, clock_thread_fn, t)) { + failed++; + nr_cpus = i; + break; + } } for (i = 0; i < nr_cpus; i++) { -- 2.25.1