summaryrefslogtreecommitdiffstats
path: root/src/core/getkey.c
diff options
context:
space:
mode:
authorMichael Brown2012-07-24 10:52:45 +0200
committerMichael Brown2012-07-24 10:56:36 +0200
commit183a70e8b783ec143e8c30296f1a7c3c7de193d7 (patch)
tree1cd1f69a9b6e00b537d2fc51eec6a8a51a54ac2d /src/core/getkey.c
parent[tcpip] Fix building under Cygwin (diff)
downloadipxe-183a70e8b783ec143e8c30296f1a7c3c7de193d7.tar.gz
ipxe-183a70e8b783ec143e8c30296f1a7c3c7de193d7.tar.xz
ipxe-183a70e8b783ec143e8c30296f1a7c3c7de193d7.zip
[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>
Diffstat (limited to 'src/core/getkey.c')
-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 f16cafa4..d69cfb44 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;