fixed compiler warnings if NDEBUG enabled in core code
[fio.git] / rate-submit.c
index 268356d17a1f1b35a6eaa0ad82219db86177a4de..bc076e869f56ad11cd7f346195ba64c902ed6ad9 100644 (file)
@@ -5,6 +5,9 @@
  *
  */
 #include <assert.h>
+#include <errno.h>
+#include <pthread.h>
+
 #include "fio.h"
 #include "ioengines.h"
 #include "lib/getrusage.h"
@@ -28,7 +31,10 @@ static void check_overlap(struct io_u *io_u)
         * threads as they assess overlap.
         */
        res = pthread_mutex_lock(&overlap_check);
-       assert(res == 0);
+       if (fio_unlikely(res != 0)) {
+               log_err("failed to lock overlap check mutex, err: %i:%s", errno, strerror(errno));
+               abort();
+       }
 
 retry:
        for_each_td(td, i) {
@@ -42,9 +48,15 @@ retry:
                        continue;
 
                res = pthread_mutex_unlock(&overlap_check);
-               assert(res == 0);
+               if (fio_unlikely(res != 0)) {
+                       log_err("failed to unlock overlap check mutex, err: %i:%s", errno, strerror(errno));
+                       abort();
+               }
                res = pthread_mutex_lock(&overlap_check);
-               assert(res == 0);
+               if (fio_unlikely(res != 0)) {
+                       log_err("failed to lock overlap check mutex, err: %i:%s", errno, strerror(errno));
+                       abort();
+               }
                goto retry;
        }
 }