summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2023-03-19 08:20:05 +0100
committerMorph <39850852+Morph1984@users.noreply.github.com>2023-03-22 00:17:38 +0100
commitf28ca5361f5242f5b65a5c54bdde55639fba71f5 (patch)
tree7a520db2cb3956b79587d70ba7bfb95a1eb40465 /src
parentbounded_threadsafe_queue: Use simplified impl of bounded queue (diff)
downloadyuzu-f28ca5361f5242f5b65a5c54bdde55639fba71f5.tar
yuzu-f28ca5361f5242f5b65a5c54bdde55639fba71f5.tar.gz
yuzu-f28ca5361f5242f5b65a5c54bdde55639fba71f5.tar.bz2
yuzu-f28ca5361f5242f5b65a5c54bdde55639fba71f5.tar.lz
yuzu-f28ca5361f5242f5b65a5c54bdde55639fba71f5.tar.xz
yuzu-f28ca5361f5242f5b65a5c54bdde55639fba71f5.tar.zst
yuzu-f28ca5361f5242f5b65a5c54bdde55639fba71f5.zip
Diffstat (limited to 'src')
-rw-r--r--src/common/logging/backend.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index 2a3bded40..e1ce9db99 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -28,7 +28,7 @@
#ifdef _WIN32
#include "common/string_util.h"
#endif
-#include "common/threadsafe_queue.h"
+#include "common/bounded_threadsafe_queue.h"
namespace Common::Log {
@@ -204,11 +204,11 @@ public:
void PushEntry(Class log_class, Level log_level, const char* filename, unsigned int line_num,
const char* function, std::string&& message) {
- if (!filter.CheckMessage(log_class, log_level))
+ if (!filter.CheckMessage(log_class, log_level)) {
return;
- const Entry& entry =
- CreateEntry(log_class, log_level, filename, line_num, function, std::move(message));
- message_queue.Push(entry);
+ }
+ message_queue.Push(
+ CreateEntry(log_class, log_level, filename, line_num, function, std::move(message)));
}
private:
@@ -225,7 +225,7 @@ private:
ForEachBackend([&entry](Backend& backend) { backend.Write(entry); });
};
while (!stop_token.stop_requested()) {
- entry = message_queue.PopWait(stop_token);
+ message_queue.PopWait(entry, stop_token);
if (entry.filename != nullptr) {
write_logs();
}
@@ -233,7 +233,7 @@ private:
// Drain the logging queue. Only writes out up to MAX_LOGS_TO_WRITE to prevent a
// case where a system is repeatedly spamming logs even on close.
int max_logs_to_write = filter.IsDebug() ? INT_MAX : 100;
- while (max_logs_to_write-- && message_queue.Pop(entry)) {
+ while (max_logs_to_write-- && message_queue.TryPop(entry)) {
write_logs();
}
});
@@ -273,7 +273,7 @@ private:
ColorConsoleBackend color_console_backend{};
FileBackend file_backend;
- MPSCQueue<Entry, true> message_queue{};
+ MPSCQueue<Entry> message_queue{};
std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()};
std::jthread backend_thread;
};