From bcba2a72ed0e0620438929942cb486ad3d08d168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Wed, 2 May 2012 15:24:40 +0200 Subject: cpu: Move CPU_COMMON_THREAD into CPUState MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CPU_COMMON_THREAD was only used for Windows, adding an hThread field to CPU_COMMON. Move the field into QOM CPUState and change its type to HANDLE, which it is assigned from. This requires Windows headers, pulled in through qemu-thread.h. Signed-off-by: Andreas Färber --- cpus.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cpus.c') diff --git a/cpus.c b/cpus.c index 756e6245fd..7042fb5837 100644 --- a/cpus.c +++ b/cpus.c @@ -852,9 +852,10 @@ static void qemu_cpu_kick_thread(CPUArchState *env) } #else /* _WIN32 */ if (!qemu_cpu_is_self(env)) { - SuspendThread(env->hThread); + CPUState *cpu = ENV_GET_CPU(env); + SuspendThread(cpu->hThread); cpu_signal(0); - ResumeThread(env->hThread); + ResumeThread(cpu->hThread); } #endif } @@ -974,6 +975,9 @@ void resume_all_vcpus(void) static void qemu_tcg_init_vcpu(void *_env) { CPUArchState *env = _env; +#ifdef _WIN32 + CPUState *cpu = ENV_GET_CPU(env); +#endif /* share a single thread for all cpus with TCG */ if (!tcg_cpu_thread) { @@ -984,7 +988,7 @@ static void qemu_tcg_init_vcpu(void *_env) qemu_thread_create(env->thread, qemu_tcg_cpu_thread_fn, env, QEMU_THREAD_JOINABLE); #ifdef _WIN32 - env->hThread = qemu_thread_get_handle(env->thread); + cpu->hThread = qemu_thread_get_handle(env->thread); #endif while (env->created == 0) { qemu_cond_wait(&qemu_cpu_cond, &qemu_global_mutex); -- cgit v1.2.1