From e771f4e75e0275c436bfad2ef03910347918e7c0 Mon Sep 17 00:00:00 2001 From: gabime Date: Tue, 17 Sep 2019 13:27:42 +0300 Subject: [PATCH] Fix mingw32 compilation --- include/spdlog/details/mpmc_blocking_q.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/spdlog/details/mpmc_blocking_q.h b/include/spdlog/details/mpmc_blocking_q.h index 1a0a303c..06b53738 100644 --- a/include/spdlog/details/mpmc_blocking_q.h +++ b/include/spdlog/details/mpmc_blocking_q.h @@ -70,7 +70,7 @@ public: // apparently mingw deadlocks if the mutex is released before cv.notify_one(), // so release the mutex at the very end each function. - // try to enqueue and block if no room left + // try to enqueue and block if no room left void enqueue(T &&item) { std::unique_lock lock(queue_mutex_); @@ -85,6 +85,7 @@ public: std::unique_lock lock(queue_mutex_); q_.push_back(std::move(item)); push_cv_.notify_one(); + } // try to dequeue item. if no item found. wait upto timeout and try again @@ -96,7 +97,8 @@ public: { return false; } - q_.pop_front(popped_item); + popped_item = std::move(q_.front()); + q_.pop_front(); pop_cv_.notify_one(); return true; }