[LIBNX] Unconditional Mutex for logging

This commit is contained in:
M4xw 2019-04-29 16:43:01 +02:00
parent ff906a9228
commit 24dadb276e
1 changed files with 10 additions and 11 deletions

View File

@ -68,10 +68,12 @@ static void* log_file_buf = NULL;
static bool main_verbosity = false; static bool main_verbosity = false;
static bool log_file_initialized = false; static bool log_file_initialized = false;
#ifdef HAVE_LIBNX
static Mutex logging_mtx;
#ifdef NXLINK #ifdef NXLINK
static Mutex nxlink_mtx;
bool nxlink_connected = false; bool nxlink_connected = false;
#endif #endif /* NXLINK */
#endif /* HAVE_LIBNX */
void verbosity_enable(void) void verbosity_enable(void)
{ {
@ -116,9 +118,8 @@ void retro_main_log_file_init(const char *path, bool append)
if (log_file_initialized) if (log_file_initialized)
return; return;
#ifdef NXLINK #ifdef HAVE_LIBNX
if (path == NULL && nxlink_connected) mutexInit(&logging_mtx);
mutexInit(&nxlink_mtx);
#endif #endif
log_file_fp = stderr; log_file_fp = stderr;
@ -243,9 +244,8 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
OutputDebugStringA(buffer); OutputDebugStringA(buffer);
#endif #endif
#else #else
#if defined(NXLINK) && !defined(HAVE_FILE_LOGGER) #if defined(HAVE_LIBNX)
if (nxlink_connected) mutexLock(&logging_mtx);
mutexLock(&nxlink_mtx);
#endif #endif
if (fp) if (fp)
{ {
@ -254,9 +254,8 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
vfprintf(fp, fmt, ap); vfprintf(fp, fmt, ap);
fflush(fp); fflush(fp);
} }
#if defined(NXLINK) && !defined(HAVE_FILE_LOGGER) #if defined(HAVE_LIBNX)
if (nxlink_connected) mutexUnlock(&logging_mtx);
mutexUnlock(&nxlink_mtx);
#endif #endif
#endif #endif