From: arighi Date: Fri, 8 Apr 2011 09:44:57 +0000 (+0000) Subject: menu: avoid starving other processes in menu_handle() X-Git-Tag: 2.7.0~128 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=6b99bcc45c4e6fb69c597b0f5fa9532b1db711cf;p=bertos.git 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 --- 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