From 183a70e8b783ec143e8c30296f1a7c3c7de193d7 Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Tue, 24 Jul 2012 09:52:45 +0100 Subject: [PATCH] [console] Sleep while waiting for user input Reduce CPU usage while waiting for user input. This is particularly important for virtual machines, where CPU is a shared resource. Reported-by: Alessandro Salvatori Signed-off-by: Michael Brown --- src/core/getkey.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/getkey.c b/src/core/getkey.c index f16cafa4..d69cfb44 100644 --- a/src/core/getkey.c +++ b/src/core/getkey.c @@ -24,6 +24,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include #include #include +#include /** @file * @@ -46,6 +47,7 @@ static int getchar_timeout ( unsigned long timeout ) { step(); if ( iskey() ) return getchar(); + cpu_nap(); } return -1;