mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-26 02:54:17 +01:00
coreinit: Make OSReport and OSConsoleWrite thread-safe
This commit is contained in:
parent
d22901be1c
commit
8dd1688ca7
@ -264,11 +264,13 @@ namespace coreinit
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
std::mutex sCafeConsoleMutex;
|
||||
|
||||
void WriteCafeConsole(CafeLogType cafeLogType, const char* msg, sint32 len)
|
||||
{
|
||||
// once a line is full or \n is written it will be posted to log
|
||||
std::unique_lock _l(sCafeConsoleMutex);
|
||||
CafeLogBuffer& logBuffer = getLogBuffer(cafeLogType);
|
||||
|
||||
// once a line is full or \n is written it will be posted to log
|
||||
auto flushLine = [](CafeLogBuffer& cafeLogBuffer, std::string_view cafeLogName) -> void
|
||||
{
|
||||
cemuLog_log(LogType::CoreinitLogging, "[{0}] {1}", cafeLogName, std::basic_string_view(cafeLogBuffer.lineBuffer.data(), cafeLogBuffer.lineLength));
|
||||
@ -354,4 +356,4 @@ namespace coreinit
|
||||
cafeExportRegister("coreinit", OSEnableHomeButtonMenu, LogType::CoreinitThread);
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user