Ver código fonte

[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 13 anos atrás
pai
commit
183a70e8b7
1 arquivos alterados com 2 adições e 0 exclusões
  1. 2
    0
      src/core/getkey.c

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

24
 #include <ipxe/process.h>
24
 #include <ipxe/process.h>
25
 #include <ipxe/keys.h>
25
 #include <ipxe/keys.h>
26
 #include <ipxe/timer.h>
26
 #include <ipxe/timer.h>
27
+#include <ipxe/nap.h>
27
 
28
 
28
 /** @file
29
 /** @file
29
  *
30
  *
46
 		step();
47
 		step();
47
 		if ( iskey() )
48
 		if ( iskey() )
48
 			return getchar();
49
 			return getchar();
50
+		cpu_nap();
49
 	}
51
 	}
50
 
52
 
51
 	return -1;
53
 	return -1;

Carregando…
Cancelar
Salvar