aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiejun Chen <tiejun.chen@windriver.com>2013-08-02 09:43:09 +0800
committerAndreas Färber <afaerber@suse.de>2013-08-16 18:44:33 +0200
commit321bc0b2b27aa2dd64bf12e0e2a0f323a4903ecf (patch)
treeb892c0278ef6457b64203c904bb43a09bd634964
parent92067bf4bfa144ea3967a9951808f5e587bdab18 (diff)
downloadqemu-321bc0b2b27aa2dd64bf12e0e2a0f323a4903ecf.zip
qemu-321bc0b2b27aa2dd64bf12e0e2a0f323a4903ecf.tar.gz
qemu-321bc0b2b27aa2dd64bf12e0e2a0f323a4903ecf.tar.bz2
cpus: Use cpu_is_stopped() efficiently
It makes more sense and will make things simpler later. Signed-off-by: Tiejun Chen <tiejun.chen@windriver.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
-rw-r--r--cpus.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/cpus.c b/cpus.c
index 0f65e76..70cc617 100644
--- a/cpus.c
+++ b/cpus.c
@@ -62,12 +62,17 @@
static CPUState *next_cpu;
+bool cpu_is_stopped(CPUState *cpu)
+{
+ return cpu->stopped || !runstate_is_running();
+}
+
static bool cpu_thread_is_idle(CPUState *cpu)
{
if (cpu->stop || cpu->queued_work_first) {
return false;
}
- if (cpu->stopped || !runstate_is_running()) {
+ if (cpu_is_stopped(cpu)) {
return true;
}
if (!cpu->halted || qemu_cpu_has_work(cpu) ||
@@ -429,11 +434,6 @@ void cpu_synchronize_all_post_init(void)
}
}
-bool cpu_is_stopped(CPUState *cpu)
-{
- return !runstate_is_running() || cpu->stopped;
-}
-
static int do_vm_stop(RunState state)
{
int ret = 0;
@@ -457,7 +457,7 @@ static bool cpu_can_run(CPUState *cpu)
if (cpu->stop) {
return false;
}
- if (cpu->stopped || !runstate_is_running()) {
+ if (cpu_is_stopped(cpu)) {
return false;
}
return true;