Refactor this

This commit is contained in:
twinaphex 2020-02-02 02:16:00 +01:00
parent e7e7a284f5
commit 8eca1a0459
3 changed files with 16 additions and 17 deletions

View File

@ -25259,8 +25259,7 @@ bool retroarch_main_init(int argc, char *argv[])
#endif
retroarch_validate_cpu_features();
rarch_ctl(RARCH_CTL_TASK_INIT, NULL);
retroarch_init_task_queue();
{
const char *fullpath = path_get(RARCH_PATH_CONTENT);
@ -25741,6 +25740,18 @@ static void rarch_init_core_options(
core_option_manager_new(options_path, src_options_path, option_defs);
}
void retroarch_init_task_queue(void)
{
#ifdef HAVE_THREADS
settings_t *settings = configuration_settings;
bool threaded_enable = settings->bools.threaded_data_runloop_enable;
#else
bool threaded_enable = false;
#endif
task_queue_deinit();
task_queue_init(threaded_enable, runloop_task_msg_queue_push);
}
bool rarch_ctl(enum rarch_ctl_state state, void *data)
{
switch(state)
@ -25925,18 +25936,6 @@ bool rarch_ctl(enum rarch_ctl_state state, void *data)
break;
case RARCH_CTL_IS_PAUSED:
return runloop_paused;
case RARCH_CTL_TASK_INIT:
{
#ifdef HAVE_THREADS
settings_t *settings = configuration_settings;
bool threaded_enable = settings->bools.threaded_data_runloop_enable;
#else
bool threaded_enable = false;
#endif
task_queue_deinit();
task_queue_init(threaded_enable, runloop_task_msg_queue_push);
}
break;
case RARCH_CTL_SET_SHUTDOWN:
runloop_shutdown_initiated = true;
break;

View File

@ -110,8 +110,6 @@ enum rarch_ctl_state
RARCH_CTL_HAS_SET_SUBSYSTEMS,
RARCH_CTL_TASK_INIT,
RARCH_CTL_IS_IDLE,
RARCH_CTL_SET_IDLE,
@ -1997,6 +1995,8 @@ bool menu_widgets_ready(void);
unsigned int retroarch_get_rotation(void);
void retroarch_init_task_queue(void);
bool is_input_keyboard_display_on(void);
RETRO_END_DECLS

View File

@ -1578,7 +1578,7 @@ bool task_push_start_dummy_core(content_ctx_info_t *content_info)
sys_info->load_no_content = false;
rarch_ctl(RARCH_CTL_STATE_FREE, NULL);
rarch_ctl(RARCH_CTL_DATA_DEINIT, NULL);
rarch_ctl(RARCH_CTL_TASK_INIT, NULL);
retroarch_init_task_queue();
/* Loads content into currently selected core. */
if (!content_load(content_info))