Create runloop_iterate_data

This commit is contained in:
twinaphex 2016-05-08 06:29:11 +02:00
parent 0f7cdeaf78
commit 13e67aa44e
9 changed files with 15 additions and 12 deletions

View File

@ -34,7 +34,7 @@ static void emscripten_mainloop(void)
int ret = runloop_iterate(&sleep_ms); int ret = runloop_iterate(&sleep_ms);
if (ret == 1 && sleep_ms > 0) if (ret == 1 && sleep_ms > 0)
retro_sleep(sleep_ms); retro_sleep(sleep_ms);
runloop_ctl(RUNLOOP_CTL_DATA_ITERATE, NULL); runloop_iterate_data();
if (ret != -1) if (ret != -1)
return; return;

View File

@ -742,7 +742,7 @@ static void android_app_entry(void *data)
if (ret == 1 && sleep_ms > 0) if (ret == 1 && sleep_ms > 0)
retro_sleep(sleep_ms); retro_sleep(sleep_ms);
runloop_ctl(RUNLOOP_CTL_DATA_ITERATE, NULL); runloop_iterate_data();
}while (ret != -1); }while (ret != -1);
main_exit(data); main_exit(data);

View File

@ -164,7 +164,7 @@ int rarch_main(int argc, char *argv[], void *data)
if (ret == 1 && sleep_ms > 0) if (ret == 1 && sleep_ms > 0)
retro_sleep(sleep_ms); retro_sleep(sleep_ms);
runloop_ctl(RUNLOOP_CTL_DATA_ITERATE, NULL); runloop_iterate_data();
}while(ret != -1); }while(ret != -1);
main_exit(args); main_exit(args);

View File

@ -78,7 +78,7 @@ static int action_select_default(const char *path, const char *label, unsigned t
if (action != MENU_ACTION_NOOP) if (action != MENU_ACTION_NOOP)
ret = menu_entry_action(&entry, idx, action); ret = menu_entry_action(&entry, idx, action);
runloop_ctl(RUNLOOP_CTL_DATA_ITERATE, NULL); runloop_iterate_data();
return ret; return ret;
} }

View File

@ -566,15 +566,17 @@ static bool runloop_check_pause_state(event_cmd_state_t *cmd)
return true; return true;
} }
void runloop_iterate_data(void)
{
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
}
bool runloop_ctl(enum runloop_ctl_state state, void *data) bool runloop_ctl(enum runloop_ctl_state state, void *data)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
switch (state) switch (state)
{ {
case RUNLOOP_CTL_DATA_ITERATE:
task_queue_ctl(TASK_QUEUE_CTL_CHECK, NULL);
break;
case RUNLOOP_CTL_SHADER_DIR_DEINIT: case RUNLOOP_CTL_SHADER_DIR_DEINIT:
shader_dir_free(&runloop_shader_dir); shader_dir_free(&runloop_shader_dir);
break; break;

View File

@ -126,7 +126,6 @@ enum runloop_ctl_state
RUNLOOP_CTL_SYSTEM_INFO_GET, RUNLOOP_CTL_SYSTEM_INFO_GET,
RUNLOOP_CTL_SYSTEM_INFO_INIT, RUNLOOP_CTL_SYSTEM_INFO_INIT,
RUNLOOP_CTL_SYSTEM_INFO_FREE, RUNLOOP_CTL_SYSTEM_INFO_FREE,
RUNLOOP_CTL_DATA_ITERATE,
RUNLOOP_CTL_PREPARE_DUMMY RUNLOOP_CTL_PREPARE_DUMMY
}; };
@ -317,6 +316,8 @@ global_t *global_get_ptr(void);
**/ **/
int runloop_iterate(unsigned *sleep_ms); int runloop_iterate(unsigned *sleep_ms);
void runloop_iterate_data(void);
void runloop_msg_queue_push(const char *msg, unsigned prio, void runloop_msg_queue_push(const char *msg, unsigned prio,
unsigned duration, bool flush); unsigned duration, bool flush);

View File

@ -754,8 +754,8 @@ didSelectRowAtIndexPath:(NSIndexPath *)indexPath
- (void)menuSelect: (uint32_t) i - (void)menuSelect: (uint32_t) i
{ {
menu_entry_select(i); menu_entry_select(i);
runloop_ctl(RUNLOOP_CTL_DATA_ITERATE, NULL); runloop_iterate_data();
} }
- (void)menuBack - (void)menuBack

View File

@ -231,7 +231,7 @@ static void poll_iteration(void)
ret = runloop_iterate(&sleep_ms); ret = runloop_iterate(&sleep_ms);
if (ret == 1 && sleep_ms > 0) if (ret == 1 && sleep_ms > 0)
retro_sleep(sleep_ms); retro_sleep(sleep_ms);
runloop_ctl(RUNLOOP_CTL_DATA_ITERATE, NULL); runloop_iterate_data();
while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE) == kCFRunLoopRunHandledSource); while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE) == kCFRunLoopRunHandledSource);
} }

View File

@ -87,7 +87,7 @@ static void rarch_draw_observer(CFRunLoopObserverRef observer,
if (ret == 1 && !ui_companion_is_on_foreground() && sleep_ms > 0) if (ret == 1 && !ui_companion_is_on_foreground() && sleep_ms > 0)
retro_sleep(sleep_ms); retro_sleep(sleep_ms);
runloop_ctl(RUNLOOP_CTL_DATA_ITERATE, NULL); runloop_iterate_data();
if (ret == -1) if (ret == -1)
{ {