mirror of
https://github.com/libretro/RetroArch
synced 2025-03-30 07:20:36 +00:00
(data runloop) Refactors
This commit is contained in:
parent
0d16858eff
commit
06279ee6c3
@ -736,15 +736,11 @@ static void rarch_main_data_overlay_iterate(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void rarch_main_data_deinit(void)
|
static void data_runloop_thread_deinit(void)
|
||||||
{
|
{
|
||||||
data_runloop_t *runloop = &g_data_runloop;
|
data_runloop_t *runloop = &g_data_runloop;
|
||||||
|
|
||||||
if (!runloop->inited)
|
if (!runloop->thread_inited)
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
if (runloop->thread_inited)
|
|
||||||
{
|
{
|
||||||
slock_lock(runloop->cond_lock);
|
slock_lock(runloop->cond_lock);
|
||||||
runloop->thread_quit = true;
|
runloop->thread_quit = true;
|
||||||
@ -755,9 +751,21 @@ static void rarch_main_data_deinit(void)
|
|||||||
slock_free(runloop->lock);
|
slock_free(runloop->lock);
|
||||||
slock_free(runloop->cond_lock);
|
slock_free(runloop->cond_lock);
|
||||||
scond_free(runloop->cond);
|
scond_free(runloop->cond);
|
||||||
|
|
||||||
runloop->thread_inited = false;
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rarch_main_data_deinit(void)
|
||||||
|
{
|
||||||
|
data_runloop_t *runloop = &g_data_runloop;
|
||||||
|
|
||||||
|
if (!runloop->inited)
|
||||||
|
return;
|
||||||
|
|
||||||
|
#ifdef HAVE_THREADS
|
||||||
|
if (runloop->thread_inited)
|
||||||
|
data_runloop_thread_deinit();
|
||||||
|
|
||||||
|
runloop->thread_inited = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
runloop->inited = false;
|
runloop->inited = false;
|
||||||
@ -789,11 +797,35 @@ static void data_thread_loop(void *data)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void rarch_main_data_thread_init(void)
|
||||||
|
{
|
||||||
|
if ((g_data_runloop.thread = sthread_create(data_thread_loop, &g_data_runloop)))
|
||||||
|
{
|
||||||
|
g_data_runloop.lock = slock_new();
|
||||||
|
g_data_runloop.cond_lock = slock_new();
|
||||||
|
g_data_runloop.cond = scond_new();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
g_data_runloop.thread = NULL;
|
||||||
|
|
||||||
|
g_data_runloop.thread_inited = (g_data_runloop.thread != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void rarch_main_data_iterate(void)
|
void rarch_main_data_iterate(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
if (g_data_runloop.thread_inited)
|
#if 0
|
||||||
return;
|
if (g_settings.menu.threaded_data_runloop_enable)
|
||||||
|
{
|
||||||
|
if (g_data_runloop.thread_inited)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (g_data_runloop.thread_inited)
|
||||||
|
data_runloop_thread_deinit();
|
||||||
|
else
|
||||||
|
rarch_main_data_thread_init();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
data_runloop_iterate(&g_data_runloop);
|
data_runloop_iterate(&g_data_runloop);
|
||||||
@ -809,22 +841,6 @@ static void rarch_main_data_init(void)
|
|||||||
g_data_runloop.thread_inited = false;
|
g_data_runloop.thread_inited = false;
|
||||||
g_data_runloop.thread_quit = false;
|
g_data_runloop.thread_quit = false;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
|
||||||
if (g_settings.menu.threaded_data_runloop_enable)
|
|
||||||
{
|
|
||||||
if ((g_data_runloop.thread = sthread_create(data_thread_loop, &g_data_runloop)))
|
|
||||||
{
|
|
||||||
g_data_runloop.lock = slock_new();
|
|
||||||
g_data_runloop.cond_lock = slock_new();
|
|
||||||
g_data_runloop.cond = scond_new();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
g_data_runloop.thread = NULL;
|
|
||||||
|
|
||||||
g_data_runloop.thread_inited = (g_data_runloop.thread != NULL);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_data_runloop.inited = true;
|
g_data_runloop.inited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user