]> git.proxmox.com Git - qemu.git/commitdiff
Fix signal handling when io-thread is disabled
authorAlexandre Raymond <cerbere@gmail.com>
Tue, 14 Jun 2011 14:05:36 +0000 (10:05 -0400)
committerBlue Swirl <blauwirbel@gmail.com>
Sat, 16 Jul 2011 19:41:08 +0000 (19:41 +0000)
Changes since v1:
- take pthread_sigmask() out of the ifdef as it is now common
to both parts.

This fix effectively blocks, in the main thread, the signals handled
by signalfd or the compatibility signal thread.

This way, such signals are received synchronously in the main thread
through sigfd_handler() instead of triggering the signal handler
directly, asynchronously.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
cpus.c

diff --git a/cpus.c b/cpus.c
index abd24ab31cf043c3b23a127b6383009f79ecac30..e02576cb66f667eb445c097ee5162fca5fb3cef3 100644 (file)
--- a/cpus.c
+++ b/cpus.c
@@ -401,7 +401,6 @@ static int qemu_signal_init(void)
     sigaddset(&set, SIGALRM);
     sigaddset(&set, SIG_IPI);
     sigaddset(&set, SIGBUS);
-    pthread_sigmask(SIG_BLOCK, &set, NULL);
 #else
     sigemptyset(&set);
     sigaddset(&set, SIGBUS);
@@ -414,6 +413,7 @@ static int qemu_signal_init(void)
         sigaddset(&set, SIGALRM);
     }
 #endif
+    pthread_sigmask(SIG_BLOCK, &set, NULL);
 
     sigfd = qemu_signalfd(&set);
     if (sigfd == -1) {