mirror of
https://github.com/cemu-project/Cemu.git
synced 2024-11-22 17:19:18 +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";
|
return "Unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::mutex sCafeConsoleMutex;
|
||||||
|
|
||||||
void WriteCafeConsole(CafeLogType cafeLogType, const char* msg, sint32 len)
|
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);
|
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
|
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));
|
cemuLog_log(LogType::CoreinitLogging, "[{0}] {1}", cafeLogName, std::basic_string_view(cafeLogBuffer.lineBuffer.data(), cafeLogBuffer.lineLength));
|
||||||
|
Loading…
Reference in New Issue
Block a user