mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-21 03:12:41 +08:00
async flush now waits for queue to be empty before returning
This commit is contained in:
parent
73a3a32325
commit
dfa2c7a950
@ -246,8 +246,14 @@ 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()
|
||||
{
|
||||
auto last_op = details::os::now();
|
||||
while (_q.approx_size() > 0)
|
||||
{
|
||||
sleep_or_yield(details::os::now(), last_op);
|
||||
}
|
||||
push_msg(async_msg(async_msg_type::flush));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user