mirror of
https://github.com/ipxe/ipxe
synced 2025-12-21 12:30:20 +03: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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user