Explorar el Código

[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>
tags/v1.20.1
Michael Brown hace 12 años
padre
commit
183a70e8b7
Se han modificado 1 ficheros con 2 adiciones y 0 borrados
  1. 2
    0
      src/core/getkey.c

+ 2
- 0
src/core/getkey.c Ver fichero

@@ -24,6 +24,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
24 24
 #include <ipxe/process.h>
25 25
 #include <ipxe/keys.h>
26 26
 #include <ipxe/timer.h>
27
+#include <ipxe/nap.h>
27 28
 
28 29
 /** @file
29 30
  *
@@ -46,6 +47,7 @@ static int getchar_timeout ( unsigned long timeout ) {
46 47
 		step();
47 48
 		if ( iskey() )
48 49
 			return getchar();
50
+		cpu_nap();
49 51
 	}
50 52
 
51 53
 	return -1;

Loading…
Cancelar
Guardar