summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@siemens.com>2011-02-01 22:15:46 +0100
committerMarcelo Tosatti <mtosatti@redhat.com>2011-02-14 12:39:44 -0200
commit8e1b90ecc59573c4c5e9fc4934b4e30476b43e2f (patch)
tree8b242421bcfbfb1aa9f6319ebe6ab649a9e95fda /vl.c
parent38145df24c55bffe8ba63cfa28173c9ddd5a2c2d (diff)
downloadqemu-8e1b90ecc59573c4c5e9fc4934b4e30476b43e2f.zip
Leave inner main_loop faster on pending requests
If there is any pending request that requires us to leave the inner loop if main_loop, makes sure we do this as soon as possible by enforcing non-blocking IO processing. At this change, move variable definitions out of the inner loop to improve readability. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/vl.c b/vl.c
index 30263d6349..9c628f01d6 100644
--- a/vl.c
+++ b/vl.c
@@ -1402,18 +1402,21 @@ qemu_irq qemu_system_powerdown;
static void main_loop(void)
{
+ bool nonblocking = false;
+#ifdef CONFIG_PROFILER
+ int64_t ti;
+#endif
int r;
qemu_main_loop_start();
for (;;) {
do {
- bool nonblocking = false;
-#ifdef CONFIG_PROFILER
- int64_t ti;
-#endif
#ifndef CONFIG_IOTHREAD
nonblocking = cpu_exec_all();
+ if (!vm_can_run()) {
+ nonblocking = true;
+ }
#endif
#ifdef CONFIG_PROFILER
ti = profile_getclock();