From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VANKr-0002hd-B1 for qemu-devel@nongnu.org; Fri, 16 Aug 2013 12:57:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VANKg-0000dT-7b for qemu-devel@nongnu.org; Fri, 16 Aug 2013 12:57:13 -0400 Received: from cantor2.suse.de ([195.135.220.15]:55469 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VANKg-0000cq-1R for qemu-devel@nongnu.org; Fri, 16 Aug 2013 12:57:02 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Fri, 16 Aug 2013 18:56:43 +0200 Message-Id: <1376672203-31191-7-git-send-email-afaerber@suse.de> In-Reply-To: <1376672203-31191-1-git-send-email-afaerber@suse.de> References: <1376672203-31191-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 6/6] cpus: Use cpu_is_stopped() efficiently List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Tiejun Chen , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Tiejun Chen It makes more sense and will make things simpler later. Signed-off-by: Tiejun Chen Signed-off-by: Andreas F=C3=A4rber --- cpus.c | 14 +++++++------- 1 file 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 @@ =20 static CPUState *next_cpu; =20 +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) } } =20 -bool cpu_is_stopped(CPUState *cpu) -{ - return !runstate_is_running() || cpu->stopped; -} - static int do_vm_stop(RunState state) { int ret =3D 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; --=20 1.8.1.4