diff options
author | Andreas Färber <afaerber@suse.de> | 2013-07-07 19:50:23 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-09-03 12:25:55 +0200 |
commit | 38fcbd3f08375eb2986b9b63ccd4f593e71aa99d (patch) | |
tree | 59da51d17fb6e9aed5da12c26f2bebd8ccfb6dce /cpus.c | |
parent | bdc44640cb33c90809376a262df871a1144d339a (diff) | |
download | hqemu-38fcbd3f08375eb2986b9b63ccd4f593e71aa99d.zip hqemu-38fcbd3f08375eb2986b9b63ccd4f593e71aa99d.tar.gz |
cpu: Replace qemu_for_each_cpu()
It was introduced to loop over CPUs from target-independent code, but
since commit 182735efaf956ccab50b6d74a4fed163e0f35660 target-independent
CPUState is used.
A loop can be considered more efficient than function calls in a loop,
and CPU_FOREACH() hides implementation details just as well, so use that
instead.
Suggested-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'cpus.c')
-rw-r--r-- | cpus.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -854,12 +854,6 @@ 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; @@ -868,7 +862,10 @@ static void *qemu_tcg_cpu_thread_fn(void *arg) qemu_thread_get_self(cpu->thread); qemu_mutex_lock(&qemu_global_mutex); - qemu_for_each_cpu(tcg_signal_cpu_creation, NULL); + CPU_FOREACH(cpu) { + cpu->thread_id = qemu_get_thread_id(); + cpu->created = true; + } qemu_cond_signal(&qemu_cpu_cond); /* wait for initial kick-off after machine start */ |