From 54389446d98ea396997c709421970b5633851c7a Mon Sep 17 00:00:00 2001 From: Brian Nixon Date: Sat, 8 Apr 2023 09:48:02 +0100 Subject: [PATCH 1/2] Correct limit check in throttler thread --- client/app.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app.cpp b/client/app.cpp index 6d1b48d4691..4c4743b93e6 100644 --- a/client/app.cpp +++ b/client/app.cpp @@ -1254,7 +1254,7 @@ void* throttler(void*) { while (1) { client_mutex.lock(); double limit = gstate.current_cpu_usage_limit(); - if (gstate.tasks_suspended || limit == 0) { + if (gstate.tasks_suspended || limit > 99.99) { client_mutex.unlock(); // ::Sleep((int)(1000*10)); // for Win debugging boinc_sleep(10); From f7b5d7fa1a9b324c59804cc357ac865d91ecde79 Mon Sep 17 00:00:00 2001 From: Brian Nixon Date: Mon, 10 Apr 2023 08:46:18 +0100 Subject: [PATCH 2/2] Make the intent of the check clearer --- client/app.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/client/app.cpp b/client/app.cpp index 4c4743b93e6..60faa111f4b 100644 --- a/client/app.cpp +++ b/client/app.cpp @@ -1254,7 +1254,8 @@ void* throttler(void*) { while (1) { client_mutex.lock(); double limit = gstate.current_cpu_usage_limit(); - if (gstate.tasks_suspended || limit > 99.99) { + const double CPU_USAGE_UNLIMITED = 99.99; + if (gstate.tasks_suspended || limit >= CPU_USAGE_UNLIMITED) { client_mutex.unlock(); // ::Sleep((int)(1000*10)); // for Win debugging boinc_sleep(10);