Fix CPU hogging issue on Android when paused.

This commit is contained in:
Themaister 2012-12-30 16:53:29 +01:00
parent 813a659f8a
commit 35e17e5017
3 changed files with 4 additions and 9 deletions

View File

@ -41,6 +41,4 @@ struct droid
extern struct droid g_android; extern struct droid g_android;
bool android_run_events(struct android_app* android_app);
#endif #endif

View File

@ -222,9 +222,9 @@ void engine_handle_cmd(struct android_app* android_app, int32_t cmd)
#define MAX_ARGS 32 #define MAX_ARGS 32
bool android_run_events(struct android_app* android_app) static bool android_run_events(struct android_app* android_app)
{ {
int id = ALooper_pollOnce(0, NULL, 0, NULL); int id = ALooper_pollOnce(-1, NULL, NULL, NULL);
if (id == LOOPER_ID_MAIN) if (id == LOOPER_ID_MAIN)
{ {
@ -242,7 +242,7 @@ bool android_run_events(struct android_app* android_app)
if (cmd == APP_CMD_INIT_WINDOW) if (cmd == APP_CMD_INIT_WINDOW)
{ {
if(g_extern.lifecycle_state & (1ULL << RARCH_REENTRANT)) if (g_extern.lifecycle_state & (1ULL << RARCH_REENTRANT))
init_drivers(); init_drivers();
if (android_app->window != NULL) if (android_app->window != NULL)

View File

@ -166,7 +166,6 @@ static void gfx_ctx_check_window(bool *quit,
{ {
(void)frame_count; (void)frame_count;
int id;
struct android_app* android_app = g_android.app; struct android_app* android_app = g_android.app;
*quit = false; *quit = false;
@ -183,9 +182,7 @@ static void gfx_ctx_check_window(bool *quit,
RARCH_PERFORMANCE_INIT(alooper_pollonce); RARCH_PERFORMANCE_INIT(alooper_pollonce);
RARCH_PERFORMANCE_START(alooper_pollonce); RARCH_PERFORMANCE_START(alooper_pollonce);
id = ALooper_pollOnce(0, NULL, 0, NULL); while (ALooper_pollOnce(0, NULL, NULL, NULL) == LOOPER_ID_MAIN)
if(id == LOOPER_ID_MAIN)
{ {
int8_t cmd; int8_t cmd;