mirror of https://github.com/ipxe/ipxe.git
[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>pull/598/head
parent
fb7c022c2c
commit
183a70e8b7
|
@ -24,6 +24,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
#include <ipxe/process.h>
|
#include <ipxe/process.h>
|
||||||
#include <ipxe/keys.h>
|
#include <ipxe/keys.h>
|
||||||
#include <ipxe/timer.h>
|
#include <ipxe/timer.h>
|
||||||
|
#include <ipxe/nap.h>
|
||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
*
|
*
|
||||||
|
@ -46,6 +47,7 @@ static int getchar_timeout ( unsigned long timeout ) {
|
||||||
step();
|
step();
|
||||||
if ( iskey() )
|
if ( iskey() )
|
||||||
return getchar();
|
return getchar();
|
||||||
|
cpu_nap();
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue