Make impl_current into static local variable

This commit is contained in:
twinaphex 2016-01-28 10:08:27 +01:00
parent d61eb7a8db
commit c53702e768

View File

@ -45,7 +45,6 @@ struct rarch_task_impl
static task_queue_t tasks_running = {NULL, NULL}; static task_queue_t tasks_running = {NULL, NULL};
static task_queue_t tasks_finished = {NULL, NULL}; static task_queue_t tasks_finished = {NULL, NULL};
static struct rarch_task_impl *impl_current = NULL;
static void task_queue_put(task_queue_t *queue, rarch_task_t *task) static void task_queue_put(task_queue_t *queue, rarch_task_t *task)
{ {
@ -371,6 +370,7 @@ static struct rarch_task_impl impl_threaded = {
bool task_ctl(enum task_ctl_state state, void *data) bool task_ctl(enum task_ctl_state state, void *data)
{ {
static struct rarch_task_impl *impl_current = NULL;
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
#endif #endif
@ -385,12 +385,11 @@ bool task_ctl(enum task_ctl_state state, void *data)
impl_current = NULL; impl_current = NULL;
break; break;
case TASK_CTL_INIT: case TASK_CTL_INIT:
impl_current = &impl_regular;
#ifdef HAVE_THREADS #ifdef HAVE_THREADS
if (settings->threaded_data_runloop_enable) if (settings->threaded_data_runloop_enable)
impl_current = &impl_threaded; impl_current = &impl_threaded;
else
#endif #endif
impl_current = &impl_regular;
impl_current->init(); impl_current->init();
break; break;
@ -413,7 +412,7 @@ bool task_ctl(enum task_ctl_state state, void *data)
task_ctl(TASK_CTL_DEINIT, NULL); task_ctl(TASK_CTL_DEINIT, NULL);
} }
if (impl_current == NULL) if (!impl_current)
task_ctl(TASK_CTL_INIT, NULL); task_ctl(TASK_CTL_INIT, NULL);
#endif #endif