1
0
mirror of https://github.com/cathery/sys-con.git synced 2024-07-03 02:18:43 +00:00

log: use scoped lock mutexes

This commit is contained in:
cathery 2020-03-11 02:04:18 +03:00
parent 9f437adca5
commit f9054f9d67

View File

@ -3,11 +3,11 @@
#include "configFile.h"
#include <stratosphere.hpp>
static Mutex g_PrintMutex = 0;
static ams::os::Mutex printMutex;
void WriteToLog(const char *fmt, ...)
{
mutexLock(&g_PrintMutex);
std::scoped_lock printLock(printMutex);
u64 ts;
TimeCalendarTime caltime;
@ -27,13 +27,10 @@ void WriteToLog(const char *fmt, ...)
fprintf(fp, "\n");
fclose(fp);
mutexUnlock(&g_PrintMutex);
}
void LockedUpdateConsole()
{
mutexLock(&g_PrintMutex);
std::scoped_lock printLock(printMutex);
consoleUpdate(NULL);
mutexUnlock(&g_PrintMutex);
}