瀏覽代碼

[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 11 年之前
父節點
當前提交
183a70e8b7
共有 1 個檔案被更改,包括 2 行新增0 行删除
  1. 2
    0
      src/core/getkey.c

+ 2
- 0
src/core/getkey.c 查看文件

@@ -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…
取消
儲存