aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2012-07-24 09:52:45 +0100
committerMichael Brown <mcb30@ipxe.org>2012-07-24 09:56:36 +0100
commit183a70e8b783ec143e8c30296f1a7c3c7de193d7 (patch)
tree1cd1f69a9b6e00b537d2fc51eec6a8a51a54ac2d
parentfb7c022c2c72c4e3a549cb7a9157e60ef2e42b09 (diff)
downloadipxe-183a70e8b783ec143e8c30296f1a7c3c7de193d7.zip
ipxe-183a70e8b783ec143e8c30296f1a7c3c7de193d7.tar.gz
ipxe-183a70e8b783ec143e8c30296f1a7c3c7de193d7.tar.bz2
[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 <alessandro@embrane.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
-rw-r--r--src/core/getkey.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/getkey.c b/src/core/getkey.c
index f16cafa..d69cfb4 100644
--- a/src/core/getkey.c
+++ b/src/core/getkey.c
@@ -24,6 +24,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/process.h>
#include <ipxe/keys.h>
#include <ipxe/timer.h>
+#include <ipxe/nap.h>
/** @file
*
@@ -46,6 +47,7 @@ static int getchar_timeout ( unsigned long timeout ) {
step();
if ( iskey() )
return getchar();
+ cpu_nap();
}
return -1;