diff options
| author | Juan Quintela <quintela@redhat.com> | 2012-09-18 16:30:11 +0200 |
|---|---|---|
| committer | Juan Quintela <quintela@redhat.com> | 2012-10-17 18:35:00 +0200 |
| commit | aa723c23147e93fef8475bd80fd29e633378c34d (patch) | |
| tree | e3bd1976f63364afedaf2c452e35fcc40f09cddf /cpus.c | |
| parent | a2b413512443e67cd58285b8d98b84792a66c710 (diff) | |
| download | focaccia-qemu-aa723c23147e93fef8475bd80fd29e633378c34d.tar.gz focaccia-qemu-aa723c23147e93fef8475bd80fd29e633378c34d.zip | |
cpus: create qemu_in_vcpu_thread()
Old code used !io_thread to know if a thread was an vcpu or not. That fails when we introduce the iothread. Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'cpus.c')
| -rw-r--r-- | cpus.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cpus.c b/cpus.c index 750a76fbc8..191cbf5f6d 100644 --- a/cpus.c +++ b/cpus.c @@ -898,6 +898,11 @@ int qemu_cpu_is_self(void *_env) return qemu_thread_is_self(cpu->thread); } +static bool qemu_in_vcpu_thread(void) +{ + return cpu_single_env && qemu_cpu_is_self(cpu_single_env); +} + void qemu_mutex_lock_iothread(void) { if (!tcg_enabled()) { @@ -943,7 +948,7 @@ void pause_all_vcpus(void) penv = penv->next_cpu; } - if (!qemu_thread_is_self(&io_thread)) { + if (qemu_in_vcpu_thread()) { cpu_stop_current(); if (!kvm_enabled()) { while (penv) { @@ -1060,7 +1065,7 @@ void cpu_stop_current(void) void vm_stop(RunState state) { - if (!qemu_thread_is_self(&io_thread)) { + if (qemu_in_vcpu_thread()) { qemu_system_vmstop_request(state); /* * FIXME: should not return to device code in case |