diff mbox series

[PULL,32/47] cpus: dummy: unregister thread with RCU, exit loop on unplug

Message ID 1517858941-5538-33-git-send-email-pbonzini@redhat.com
State New
Headers show
Series [PULL,01/47] memory: update comments and fix some typos | expand

Commit Message

Paolo Bonzini Feb. 5, 2018, 7:28 p.m. UTC
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 cpus.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/cpus.c b/cpus.c
index 1063dac..190ad5a 100644
--- a/cpus.c
+++ b/cpus.c
@@ -1234,7 +1234,7 @@  static void *qemu_dummy_cpu_thread_fn(void *arg)
     cpu->created = true;
     qemu_cond_signal(&qemu_cpu_cond);
 
-    while (1) {
+    do {
         qemu_mutex_unlock_iothread();
         do {
             int sig;
@@ -1246,8 +1246,9 @@  static void *qemu_dummy_cpu_thread_fn(void *arg)
         }
         qemu_mutex_lock_iothread();
         qemu_wait_io_event(cpu);
-    }
+    } while (!cpu->unplug);
 
+    rcu_unregister_thread();
     return NULL;
 #endif
 }