2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-11-22 09:31:51 +00:00

[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>
This commit is contained in:
Michael Brown 2012-07-24 09:52:45 +01:00
parent fb7c022c2c
commit 183a70e8b7

View File

@ -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;