From d01e288afc8ec62a1e32f531e47cafe5db7dcd17 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sat, 3 Sep 2016 01:33:07 +0300 Subject: [PATCH] fix flush async flush --- include/spdlog/details/async_log_helper.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/spdlog/details/async_log_helper.h b/include/spdlog/details/async_log_helper.h index 347b2037..3a467258 100644 --- a/include/spdlog/details/async_log_helper.h +++ b/include/spdlog/details/async_log_helper.h @@ -133,7 +133,7 @@ public: void set_formatter(formatter_ptr); - void flush(); + void flush(bool wait_for_q); private: @@ -249,12 +249,12 @@ inline void spdlog::details::async_log_helper::push_msg(details::async_log_helpe } -//wait for the queue be empty and request flush from its sinks -inline void spdlog::details::async_log_helper::flush() +// optionally wait for the queue be empty and request flush from the sinks +inline void spdlog::details::async_log_helper::flush(bool wait_for_q) { - wait_empty_q(); push_msg(async_msg(async_msg_type::flush)); - wait_empty_q(); //make sure the above flush message was processed + if(wait_for_q) + wait_empty_q(); //return only make after the above flush message was processed } inline void spdlog::details::async_log_helper::worker_loop()