Synchronize thread access with a mutex instead of atomic<bool>

This commit is contained in:
nobounce 2023-09-18 18:45:18 +02:00 committed by Steffen Winter
parent 3c92f2b912
commit e04cbcde8a
No known key found for this signature in database
GPG key ID: D4053C3600EF3B1F

View file

@ -18,7 +18,7 @@ namespace fs = std::filesystem;
namespace Logger {
using namespace Tools;
std::atomic<bool> busy(false);
std::mutex log_mtx {};
bool first = true;
const string tdf = "%Y/%m/%d (%T) | ";
@ -48,7 +48,7 @@ namespace Logger {
if (loglevel < level or logfile.empty()) {
return;
}
atomic_lock lck(busy, true);
std::lock_guard lock {log_mtx};
lose_priv neutered{};
std::error_code ec;
try {