diff options
author | Michael Brown <mcb30@ipxe.org> | 2012-07-24 09:52:45 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2012-07-24 09:56:36 +0100 |
commit | 183a70e8b783ec143e8c30296f1a7c3c7de193d7 (patch) | |
tree | 1cd1f69a9b6e00b537d2fc51eec6a8a51a54ac2d /src/core/getkey.c | |
parent | fb7c022c2c72c4e3a549cb7a9157e60ef2e42b09 (diff) | |
download | ipxe-183a70e8b783ec143e8c30296f1a7c3c7de193d7.tar.gz |
[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.c | 2 |
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; |