Browse Source

[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 12 years ago
parent
commit
183a70e8b7
1 changed files with 2 additions and 0 deletions
  1. 2
    0
      src/core/getkey.c

+ 2
- 0
src/core/getkey.c View File

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;

Loading…
Cancel
Save