Try to conserve on CPU usage when in sleep mode by skipping

menu rendering
This commit is contained in:
Twinaphex 2015-11-27 23:37:23 +01:00
parent 3e4ba02c9c
commit 4a3b9ffc7c
4 changed files with 10 additions and 5 deletions

View File

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

View File

@ -31,9 +31,10 @@ void rarch_main_data_deinit(void)
rarch_task_deinit();
}
void rarch_main_data_iterate(void)
void rarch_main_data_iterate(bool sleeping)
{
#ifdef HAVE_MENU
if (!sleeping)
menu_iterate_render();
#endif

View File

@ -26,7 +26,7 @@ typedef int (*transfer_cb_t)(void *data, size_t len);
void rarch_main_data_clear_state(void);
void rarch_main_data_iterate(void);
void rarch_main_data_iterate(bool sleeping);
void rarch_main_data_deinit(void);

View File

@ -226,12 +226,16 @@ static void poll_iteration(void)
int ret = 0;
while (ret != -1)
{
bool sleeping = false;
unsigned sleep_ms = 0;
poll_iteration();
ret = rarch_main_iterate(&sleep_ms);
if (ret == 1 && sleep_ms > 0)
{
sleeping = true;
retro_sleep(sleep_ms);
rarch_main_data_iterate();
}
rarch_main_data_iterate(sleeping);
while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.002, FALSE) == kCFRunLoopRunHandledSource);
}