[PATCH] qemu-kvm: Consolidate kvm_eat_signals

Jan Kiszka
2008-05-12T10:50:04Z

Having both kvm_eat_signal and kvm_eat_signals makes the code harder to
read. Moreover, given the single caller of kvm_eat_signals, there is no
real reason to keep it in a separate function.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
---
qemu/qemu-kvm.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)

Index: b/qemu/qemu-kvm.c
===================================================================
--- a/qemu/qemu-kvm.c
+++ b/qemu/qemu-kvm.c
@@ -210,11 +210,12 @@ static int kvm_eat_signal(CPUState *env,
return ret;
}

-
-static void kvm_eat_signals(CPUState *env, int timeout)
+static void kvm_main_loop_wait(CPUState *env, int timeout)
{
int r = 0;

+ pthread_mutex_unlock(&qemu_mutex);
+
while (kvm_eat_signal(env, 0))
r = 1;
if (!r && timeout) {
@@ -223,14 +224,10 @@ static void kvm_eat_signals(CPUState *en
while (kvm_eat_signal(env, 0))
;
}
-}

-static void kvm_main_loop_wait(CPUState *env, int timeout)
-{
- pthread_mutex_unlock(&qemu_mutex);
- kvm_eat_signals(env, timeout);
pthread_mutex_lock(&qemu_mutex);
cpu_single_env = env;
+
vcpu_info[env->cpu_index].signalled = 0;
}