From f9054f9d67412b9cfc4bd6a0ce756ce76495c215 Mon Sep 17 00:00:00 2001 From: cathery Date: Wed, 11 Mar 2020 02:04:18 +0300 Subject: [PATCH] log: use scoped lock mutexes --- source/Sysmodule/source/log.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/source/Sysmodule/source/log.cpp b/source/Sysmodule/source/log.cpp index 1db5671..3654046 100644 --- a/source/Sysmodule/source/log.cpp +++ b/source/Sysmodule/source/log.cpp @@ -3,11 +3,11 @@ #include "configFile.h" #include -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); } \ No newline at end of file