Skip to content

Commit

Permalink
[console] Sleep while waiting for user input
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mcb30 committed Jul 24, 2012
1 parent fb7c022 commit 183a70e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/core/getkey.c
Expand Up @@ -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
*
Expand All @@ -46,6 +47,7 @@ static int getchar_timeout ( unsigned long timeout ) {
step();
if ( iskey() )
return getchar();
cpu_nap();
}

return -1;
Expand Down

0 comments on commit 183a70e

Please sign in to comment.