From 5664aed99a4ab6e661b40e475449a32150f46184 Mon Sep 17 00:00:00 2001 From: Alexandre Raymond Date: Tue, 14 Jun 2011 10:05:36 -0400 Subject: [PATCH] Fix signal handling when io-thread is disabled 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 Acked-by: Jan Kiszka Signed-off-by: Blue Swirl --- cpus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index abd24ab31..e02576cb6 100644 --- 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) {