From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:55841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWUG4-0001DA-On for qemu-devel@nongnu.org; Tue, 14 Jun 2011 10:06:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QWUG3-0004yD-5a for qemu-devel@nongnu.org; Tue, 14 Jun 2011 10:06:20 -0400 Received: from mail-vx0-f173.google.com ([209.85.220.173]:33866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QWUG3-0004y6-1d for qemu-devel@nongnu.org; Tue, 14 Jun 2011 10:06:19 -0400 Received: by vxb37 with SMTP id 37so5091958vxb.4 for ; Tue, 14 Jun 2011 07:06:18 -0700 (PDT) From: Alexandre Raymond Date: Tue, 14 Jun 2011 10:05:36 -0400 Message-Id: <1308060336-608-1-git-send-email-cerbere@gmail.com> Subject: [Qemu-devel] [PATCH v2] Fix signal handling when io-thread is disabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexandre Raymond , pbonzini@redhat.com, andreas.faerber@web.de, agraf@suse.de, jan.kiszka@siemens.com 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 --- cpus.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/cpus.c b/cpus.c index 4ab76f0..18a1522 100644 --- a/cpus.c +++ b/cpus.c @@ -399,7 +399,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); @@ -412,6 +411,7 @@ static int qemu_signal_init(void) sigaddset(&set, SIGALRM); } #endif + pthread_sigmask(SIG_BLOCK, &set, NULL); sigfd = qemu_signalfd(&set); if (sigfd == -1) { -- 1.7.5