]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[console] Sleep while waiting for user input
authorMichael Brown <mcb30@ipxe.org>
Tue, 24 Jul 2012 08:52:45 +0000 (09:52 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 24 Jul 2012 08:56:36 +0000 (09:56 +0100)
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>
src/core/getkey.c

index f16cafa42838419b9fbf950cc2260b7efd617b09..d69cfb44b9c404a31a39236260cbf4a0ba4ff5b6 100644 (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;