From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXtgB-00030B-9N for qemu-devel@nongnu.org; Thu, 02 May 2013 09:36:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXtg3-0004W1-MW for qemu-devel@nongnu.org; Thu, 02 May 2013 09:36:11 -0400 Received: from cantor2.suse.de ([195.135.220.15]:46614 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXtg3-0004VX-GY for qemu-devel@nongnu.org; Thu, 02 May 2013 09:36:03 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 2 May 2013 15:35:35 +0200 Message-Id: <1367501755-32272-10-git-send-email-afaerber@suse.de> In-Reply-To: <1367501755-32272-1-git-send-email-afaerber@suse.de> References: <1367501755-32272-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 09/29] cpus: Use qemu_for_each_cpu() in TCG thread List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Igor Mammedov Replaces an open-coded loop and hides unused CPUArchState. Signed-off-by: Igor Mammedov Signed-off-by: Andreas F=C3=A4rber --- cpus.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cpus.c b/cpus.c index 1d88761..a2d92c7 100644 --- a/cpus.c +++ b/cpus.c @@ -812,6 +812,12 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) =20 static void tcg_exec_all(void); =20 +static void tcg_signal_cpu_creation(CPUState *cpu, void *data) +{ + cpu->thread_id =3D qemu_get_thread_id(); + cpu->created =3D true; +} + static void *qemu_tcg_cpu_thread_fn(void *arg) { CPUState *cpu =3D arg; @@ -820,13 +826,8 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) qemu_tcg_init_cpu_signals(); qemu_thread_get_self(cpu->thread); =20 - /* signal CPU creation */ qemu_mutex_lock(&qemu_global_mutex); - for (env =3D first_cpu; env !=3D NULL; env =3D env->next_cpu) { - cpu =3D ENV_GET_CPU(env); - cpu->thread_id =3D qemu_get_thread_id(); - cpu->created =3D true; - } + qemu_for_each_cpu(tcg_signal_cpu_creation, NULL); qemu_cond_signal(&qemu_cpu_cond); =20 /* wait for initial kick-off after machine start */ --=20 1.8.1.4