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:
parent
fb7c022c2c
commit
183a70e8b7
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user