iolog: fix potential duplicate definition of compress init/exit
[fio.git] / workqueue.c
index 9bec0c329e742aaa64e883148247bd803fa27113..5fd95b905aa8dff77090fcebdd7d1459a8b38067 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Rated submission helpers
+ * Generic workqueue offload mechanism
  *
  * Copyright (C) 2015 Jens Axboe <axboe@kernel.dk>
  *
@@ -9,7 +9,6 @@
 #include "fio.h"
 #include "flist.h"
 #include "workqueue.h"
-#include "lib/getrusage.h"
 
 enum {
        SW_F_IDLE       = 1 << 0,
@@ -235,6 +234,9 @@ void workqueue_exit(struct workqueue *wq)
        struct submit_worker *sw;
        int i;
 
+       if (!wq->workers)
+               return;
+
        for (i = 0; i < wq->max_workers; i++) {
                sw = &wq->workers[i];
 
@@ -259,6 +261,7 @@ void workqueue_exit(struct workqueue *wq)
        } while (shutdown && shutdown != wq->max_workers);
 
        free(wq->workers);
+       wq->workers = NULL;
        pthread_mutex_destroy(&wq->flush_lock);
        pthread_cond_destroy(&wq->flush_cond);
        pthread_mutex_destroy(&wq->stat_lock);