From 6b99bcc45c4e6fb69c597b0f5fa9532b1db711cf Mon Sep 17 00:00:00 2001 From: arighi Date: Fri, 8 Apr 2011 09:44:57 +0000 Subject: [PATCH] menu: avoid starving other processes in menu_handle() When CONFIG_MENU_SMOOTH is enabled the menu_handle() can run indefinitely without explicitly releasing the CPU. So, add a voluntary preemption point in menu_handle() to avoid starvation of the other processes when the kernel preemption is not enabled. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@4838 38d2e660-2303-0410-9eaa-f027e97ec537 --- bertos/gui/menu.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bertos/gui/menu.c b/bertos/gui/menu.c index f0e1f407..43292789 100644 --- a/bertos/gui/menu.c +++ b/bertos/gui/menu.c @@ -49,6 +49,8 @@ #include #include +#include + #include #include /* strcpy() */ @@ -464,6 +466,7 @@ iptr_t menu_handle(const struct Menu *menu) #if CONFIG_MENU_SMOOTH || (CONFIG_MENU_TIMEOUT != 0) key = kbd_peek(); + cpu_relax(); #else key = kbd_get(); #endif -- 2.25.1