From a37677c32bb313f5ba48aaf89f81cdc10c23ce56 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Tue, 23 Apr 2013 10:29:42 +0200 Subject: cpus: Use qemu_for_each_cpu() in TCG thread MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replaces an open-coded loop and hides unused CPUArchState. Signed-off-by: Igor Mammedov Signed-off-by: Andreas Färber --- cpus.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'cpus.c') diff --git a/cpus.c b/cpus.c index 1d8876157c..a2d92c7a88 100644 --- a/cpus.c +++ b/cpus.c @@ -812,6 +812,12 @@ static void *qemu_dummy_cpu_thread_fn(void *arg) static void tcg_exec_all(void); +static void tcg_signal_cpu_creation(CPUState *cpu, void *data) +{ + cpu->thread_id = qemu_get_thread_id(); + cpu->created = true; +} + static void *qemu_tcg_cpu_thread_fn(void *arg) { CPUState *cpu = 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); - /* signal CPU creation */ qemu_mutex_lock(&qemu_global_mutex); - for (env = first_cpu; env != NULL; env = env->next_cpu) { - cpu = ENV_GET_CPU(env); - cpu->thread_id = qemu_get_thread_id(); - cpu->created = true; - } + qemu_for_each_cpu(tcg_signal_cpu_creation, NULL); qemu_cond_signal(&qemu_cpu_cond); /* wait for initial kick-off after machine start */ -- cgit v1.2.1