From: Michael Brown Date: Tue, 24 Jul 2012 08:52:45 +0000 (+0100) Subject: [console] Sleep while waiting for user input X-Git-Tag: v1.20.1~1681 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=183a70e8b783ec143e8c30296f1a7c3c7de193d7;p=thirdparty%2Fipxe.git [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 --- diff --git a/src/core/getkey.c b/src/core/getkey.c index f16cafa42..d69cfb44b 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;