summaryrefslogtreecommitdiffstats
path: root/accel/dummy-cpus.c
diff options
context:
space:
mode:
Diffstat (limited to 'accel/dummy-cpus.c')
-rw-r--r--accel/dummy-cpus.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/accel/dummy-cpus.c b/accel/dummy-cpus.c
index 10429fdfb2..d6a1b8d0a2 100644
--- a/accel/dummy-cpus.c
+++ b/accel/dummy-cpus.c
@@ -21,8 +21,6 @@
static void *dummy_cpu_thread_fn(void *arg)
{
CPUState *cpu = arg;
- sigset_t waitset;
- int r;
rcu_register_thread();
@@ -32,8 +30,13 @@ static void *dummy_cpu_thread_fn(void *arg)
cpu->can_do_io = 1;
current_cpu = cpu;
+#ifndef _WIN32
+ sigset_t waitset;
+ int r;
+
sigemptyset(&waitset);
sigaddset(&waitset, SIG_IPI);
+#endif
/* signal CPU creation */
cpu_thread_signal_created(cpu);
@@ -41,6 +44,7 @@ static void *dummy_cpu_thread_fn(void *arg)
do {
qemu_mutex_unlock_iothread();
+#ifndef _WIN32
do {
int sig;
r = sigwait(&waitset, &sig);
@@ -49,6 +53,9 @@ static void *dummy_cpu_thread_fn(void *arg)
perror("sigwait");
exit(1);
}
+#else
+ qemu_sem_wait(&cpu->sem);
+#endif
qemu_mutex_lock_iothread();
qemu_wait_io_event(cpu);
} while (!cpu->unplug);
@@ -69,4 +76,7 @@ void dummy_start_vcpu_thread(CPUState *cpu)
cpu->cpu_index);
qemu_thread_create(cpu->thread, thread_name, dummy_cpu_thread_fn, cpu,
QEMU_THREAD_JOINABLE);
+#ifdef _WIN32
+ qemu_sem_init(&cpu->sem, 0);
+#endif
}