Kaynağa Gözat

[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 yıl önce
ebeveyn
işleme
183a70e8b7
1 değiştirilmiş dosya ile 2 ekleme ve 0 silme
  1. 2
    0
      src/core/getkey.c

+ 2
- 0
src/core/getkey.c Dosyayı Görüntüle

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…
İptal
Kaydet