From 8a6b77ef5902e72c4cea4cc9caedc8c5864aaec2 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 25 Mar 2014 11:53:22 -0700 Subject: [PATCH] client: fix bug where get_screensaver_tasks GUI RPC returned no tasks during CPU throttling --- client/gui_rpc_server_ops.cpp | 3 +-- lib/common_defs.h | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/client/gui_rpc_server_ops.cpp b/client/gui_rpc_server_ops.cpp index a8a52a4dea..0a32ccc568 100644 --- a/client/gui_rpc_server_ops.cpp +++ b/client/gui_rpc_server_ops.cpp @@ -599,8 +599,7 @@ static void handle_get_screensaver_tasks(GUI_RPC_CONN& grc) { ); for (i=0; itask_state() == PROCESS_EXECUTING) || - ((atp->task_state() == PROCESS_SUSPENDED) && (gstate.suspend_reason == SUSPEND_REASON_CPU_THROTTLE))) { + if (atp->scheduler_state == CPU_SCHED_SCHEDULED) { atp->result->write_gui(grc.mfout); } } diff --git a/lib/common_defs.h b/lib/common_defs.h index 325100a5f8..01142c638e 100644 --- a/lib/common_defs.h +++ b/lib/common_defs.h @@ -92,8 +92,11 @@ // (used internally within the client; // changed to MSG_USER_ALERT before passing to manager) -// bitmap defs for task_suspend_reason, network_suspend_reason -// Note: doesn't need to be a bitmap, but keep for compatibility +// values for suspend_reason, network_suspend_reason +// Notes: +// - doesn't need to be a bitmap, but keep for compatibility +// - with new CPU throttling implementation (separate thread) +// CLIENT_STATE.suspend_reason will never be SUSPEND_REASON_CPU_THROTTLE. // enum SUSPEND_REASON { SUSPEND_REASON_BATTERIES = 1,