From 19547d09f72b8fcda224f86c846deb2c46f2edd7 Mon Sep 17 00:00:00 2001 From: Peter Mitsis Date: Wed, 14 Sep 2016 15:40:01 -0400 Subject: [PATCH] unified: Eliminate useless check in idle thread There is no reason to check if the idle thread is a cooperative thread before invoking k_yield(); it is safe to unconditionally invoke it every iteration. Rationale: If the idle thread is cooperative, k_yield() must be invoked to allow a new thread to get scheduled to run. If the idle thread is preemptive, then k_yield() effectively becomes a no-op. Change-Id: Ide3204c92381640b5d12b39ca0f258d56d8cc3d0 Signed-off-by: Peter Mitsis --- kernel/unified/init.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/unified/init.c b/kernel/unified/init.c index e91f34c24ef..dab5c7c0baa 100644 --- a/kernel/unified/init.c +++ b/kernel/unified/init.c @@ -199,9 +199,7 @@ static void idle(void *unused1, void *unused2, void *unused3) for (;;) { nano_cpu_idle(); - if (_is_coop(_current)) { - k_yield(); - } + k_yield(); } }