aboutsummaryrefslogtreecommitdiff
path: root/cpus.c
diff options
context:
space:
mode:
authorAndreas Färber <afaerber@suse.de>2012-05-03 02:11:45 +0200
committerAndreas Färber <afaerber@suse.de>2012-10-31 01:02:45 +0100
commitc64ca8140e9c21cd0d44c10fbe1247cb4ade8e6e (patch)
tree966e1d330cb94f45c6af9126f37e28e5736ef1eb /cpus.c
parentc08d7424d600dce915a5506e95d55a359c243c66 (diff)
downloadqemu-c64ca8140e9c21cd0d44c10fbe1247cb4ade8e6e.zip
qemu-c64ca8140e9c21cd0d44c10fbe1247cb4ade8e6e.tar.gz
qemu-c64ca8140e9c21cd0d44c10fbe1247cb4ade8e6e.tar.bz2
cpu: Move queued_work_{first,last} to CPUState
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'cpus.c')
-rw-r--r--cpus.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/cpus.c b/cpus.c
index b802d38..307c1f2 100644
--- a/cpus.c
+++ b/cpus.c
@@ -66,7 +66,7 @@ static bool cpu_thread_is_idle(CPUArchState *env)
{
CPUState *cpu = ENV_GET_CPU(env);
- if (cpu->stop || env->queued_work_first) {
+ if (cpu->stop || cpu->queued_work_first) {
return false;
}
if (cpu->stopped || !runstate_is_running()) {
@@ -652,12 +652,12 @@ void run_on_cpu(CPUArchState *env, void (*func)(void *data), void *data)
wi.func = func;
wi.data = data;
- if (!env->queued_work_first) {
- env->queued_work_first = &wi;
+ if (cpu->queued_work_first == NULL) {
+ cpu->queued_work_first = &wi;
} else {
- env->queued_work_last->next = &wi;
+ cpu->queued_work_last->next = &wi;
}
- env->queued_work_last = &wi;
+ cpu->queued_work_last = &wi;
wi.next = NULL;
wi.done = false;
@@ -672,18 +672,19 @@ void run_on_cpu(CPUArchState *env, void (*func)(void *data), void *data)
static void flush_queued_work(CPUArchState *env)
{
+ CPUState *cpu = ENV_GET_CPU(env);
struct qemu_work_item *wi;
- if (!env->queued_work_first) {
+ if (cpu->queued_work_first == NULL) {
return;
}
- while ((wi = env->queued_work_first)) {
- env->queued_work_first = wi->next;
+ while ((wi = cpu->queued_work_first)) {
+ cpu->queued_work_first = wi->next;
wi->func(wi->data);
wi->done = true;
}
- env->queued_work_last = NULL;
+ cpu->queued_work_last = NULL;
qemu_cond_broadcast(&qemu_work_cond);
}