From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59326) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ull4e-00014M-FO for qemu-devel@nongnu.org; Sun, 09 Jun 2013 15:14:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ull4c-0000qD-WD for qemu-devel@nongnu.org; Sun, 09 Jun 2013 15:14:44 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44464 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ull4c-0000q1-LJ for qemu-devel@nongnu.org; Sun, 09 Jun 2013 15:14:42 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 4166BA398F for ; Sun, 9 Jun 2013 21:14:42 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 9 Jun 2013 21:13:16 +0200 Message-Id: <1370805206-26574-50-git-send-email-afaerber@suse.de> In-Reply-To: <1370805206-26574-1-git-send-email-afaerber@suse.de> References: <1370805206-26574-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] [PATCH qom-cpu 49/59] cpus: Abstract all_vcpus_paused() with qemu_for_each_cpu() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= Change return type from int to bool while at it. Signed-off-by: Andreas F=C3=A4rber --- cpus.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cpus.c b/cpus.c index 506a0c8..3856bf1 100644 --- a/cpus.c +++ b/cpus.c @@ -946,19 +946,21 @@ void qemu_mutex_unlock_iothread(void) qemu_mutex_unlock(&qemu_global_mutex); } =20 -static int all_vcpus_paused(void) +static void one_vcpu_paused(CPUState *cpu, void *data) { - CPUArchState *penv =3D first_cpu; + bool *all_paused =3D data; =20 - while (penv) { - CPUState *pcpu =3D ENV_GET_CPU(penv); - if (!pcpu->stopped) { - return 0; - } - penv =3D penv->next_cpu; + if (!cpu->stopped) { + *all_paused =3D false; } +} + +static bool all_vcpus_paused(void) +{ + bool ret =3D true; =20 - return 1; + qemu_for_each_cpu(one_vcpu_paused, &ret); + return ret; } =20 static void pause_one_vcpu(CPUState *cpu, void *data) --=20 1.8.1.4