Skip to content
Snippets Groups Projects
Commit 6daebaaa authored by James Rowe's avatar James Rowe
Browse files

Logging: Don't lock the queue for the duration of the write

parent b30c5370
No related branches found
No related tags found
No related merge requests found
...@@ -83,8 +83,10 @@ private: ...@@ -83,8 +83,10 @@ private:
} }
}; };
while (true) { while (true) {
std::unique_lock<std::mutex> lock(message_mutex); {
message_cv.wait(lock, [&] { return !running || message_queue.Pop(entry); }); std::unique_lock<std::mutex> lock(message_mutex);
message_cv.wait(lock, [&] { return !running || message_queue.Pop(entry); });
}
if (!running) { if (!running) {
break; break;
} }
...@@ -282,4 +284,4 @@ void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename, ...@@ -282,4 +284,4 @@ void FmtLogMessageImpl(Class log_class, Level log_level, const char* filename,
Impl::Instance().PushEntry(std::move(entry)); Impl::Instance().PushEntry(std::move(entry));
} }
} // namespace Log } // namespace Log
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment