Merge pull request #7336 from libretro/switch_nxlink_threading

Switch nxlink threading
This commit is contained in:
Twinaphex 2018-10-01 01:31:17 +02:00 committed by GitHub
commit 6847bb8845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 3 deletions

View File

@ -94,8 +94,6 @@ static ssize_t switch_audio_write(void *data, const void *buf, size_t size)
{
if (swa->blocking)
{
RARCH_LOG("No buffer, blocking...\n");
while(swa->current_buffer == NULL)
{
uint32_t handle_idx = 0;

View File

@ -62,6 +62,10 @@ static uint32_t *splashData = NULL;
static bool psmInitialized = false;
#ifdef NXLINK
extern bool nxlink_connected;
#endif
#endif // HAVE_LIBNX
static void get_first_valid_core(char *path_return)
@ -614,7 +618,7 @@ static void frontend_switch_init(void *data)
#endif // HAVE_OPENGL
#ifdef NXLINK
socketInitializeDefault();
nxlinkStdio();
nxlink_connected = nxlinkStdio() != -1;
#ifndef IS_SALAMANDER
verbosity_enable();
#endif // IS_SALAMANDER

View File

@ -63,6 +63,11 @@ static void* log_file_buf = NULL;
static bool main_verbosity = false;
static bool log_file_initialized = false;
#ifdef NXLINK
static Mutex nxlink_mtx;
bool nxlink_connected = false;
#endif
void verbosity_enable(void)
{
main_verbosity = true;
@ -101,6 +106,11 @@ void retro_main_log_file_init(const char *path)
if (log_file_initialized)
return;
#ifdef NXLINK
if (path == NULL && nxlink_connected)
mutexInit(&nxlink_mtx);
#endif
log_file_fp = stderr;
if (path == NULL)
return;
@ -199,6 +209,10 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
ui_companion_driver_log_msg(buffer);
#else
#if defined(NXLINK) && !defined(HAVE_FILE_LOGGER)
if (nxlink_connected)
mutexLock(&nxlink_mtx);
#endif
if (fp)
{
fprintf(fp, "%s ",
@ -206,6 +220,11 @@ void RARCH_LOG_V(const char *tag, const char *fmt, va_list ap)
vfprintf(fp, fmt, ap);
fflush(fp);
}
#if defined(NXLINK) && !defined(HAVE_FILE_LOGGER)
if (nxlink_connected)
mutexUnlock(&nxlink_mtx);
#endif
#endif
}
#endif