From 5fe93fb0326ab2b2f489a83a3b14cf5da505e89a Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Tue, 5 Nov 2019 18:45:05 +0300 Subject: [PATCH] Avoid repetitive calling event processing while in park mode. (#3544) --- runtime/src/main/cpp/Worker.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/runtime/src/main/cpp/Worker.cpp b/runtime/src/main/cpp/Worker.cpp index 6b5bbf29aff..8b58357af88 100644 --- a/runtime/src/main/cpp/Worker.cpp +++ b/runtime/src/main/cpp/Worker.cpp @@ -770,7 +770,7 @@ bool Worker::waitForQueueLocked(KLong timeoutMicroseconds, KLong* remaining) { continue; } if (timeoutMicroseconds >= 0) { - closestToRun = timeoutMicroseconds < closestToRun || closestToRun < 0 ? timeoutMicroseconds : closestToRun; + closestToRun = (timeoutMicroseconds < closestToRun || closestToRun < 0) ? timeoutMicroseconds : closestToRun; } if (closestToRun == 0) { // Just no wait at all here. @@ -819,11 +819,7 @@ bool Worker::park(KLong timeoutMicroseconds, bool process) { return false; } } - int processed = 0; - while (processQueueElement(false) >= JOB_REGULAR) { - processed++; - } - return processed > 0; + return processQueueElement(false) >= JOB_REGULAR; } JobKind Worker::processQueueElement(bool blocking) {