Skip to content

Commit f287b99

Browse files
committed
util: Avoid concurrent writes to log file
1 parent ba138e8 commit f287b99

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/util/util_log.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using PFN_wineDbgOutput = int(__cdecl*)(const char*);
66

77
static PFN_wineDbgOutput wineDbgOutput = nullptr;
8+
static std::mutex fileStreamMutex;
89

910
namespace dxvk::log {
1011
void print(const std::string& message) {
@@ -56,7 +57,9 @@ namespace dxvk::log {
5657
return;
5758

5859
print(message);
59-
if (filestream)
60+
if (filestream) {
61+
std::scoped_lock lock(fileStreamMutex);
6062
filestream << message << std::endl;
63+
}
6164
}
6265
}

0 commit comments

Comments
 (0)