gettime: handle pthread_create() failure
authorJens Axboe <axboe@fb.com>
Mon, 14 Apr 2014 18:14:17 +0000 (12:14 -0600)
committerJens Axboe <axboe@fb.com>
Mon, 14 Apr 2014 18:14:17 +0000 (12:14 -0600)
Signed-off-by: Jens Axboe <axboe@fb.com>
gettime.c

index 98e83b85a6b55ef2a059ced730459e1f9c1697a2..d261e22e968b864ab1723b819759e87024d1cc9f 100644 (file)
--- 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_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++) {
        }
 
        for (i = 0; i < nr_cpus; i++) {