From patchwork Fri Aug 6 08:05:20 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 61072 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 659FAB6EF2 for ; Fri, 6 Aug 2010 18:06:21 +1000 (EST) Received: from localhost ([127.0.0.1]:44726 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OhHwY-00008C-Ar for incoming@patchwork.ozlabs.org; Fri, 06 Aug 2010 04:06:18 -0400 Received: from [140.186.70.92] (port=34506 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OhHvn-00007z-3F for qemu-devel@nongnu.org; Fri, 06 Aug 2010 04:05:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OhHvg-0006TZ-H5 for qemu-devel@nongnu.org; Fri, 06 Aug 2010 04:05:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13099) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OhHvg-0006TC-8l for qemu-devel@nongnu.org; Fri, 06 Aug 2010 04:05:24 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o7685NRv012508 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 6 Aug 2010 04:05:23 -0400 Received: from rincewind.home.kraxel.org (vpn2-10-74.ams2.redhat.com [10.36.10.74]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o7685LDu024553; Fri, 6 Aug 2010 04:05:22 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id E31574005F; Fri, 6 Aug 2010 10:05:20 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 6 Aug 2010 10:05:20 +0200 Message-Id: <1281081920-19538-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH] Block I/O signals in audio helper threads. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Otherwise qemu might be killed due to SIGIO being received by a thread which isn't prepared for that. Seen happening with pulseaudio backend. Signed-off-by: Gerd Hoffmann Acked-by: Paolo Bonzini --- audio/audio_pt_int.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/audio/audio_pt_int.c b/audio/audio_pt_int.c index e889a98..0e5aa2c 100644 --- a/audio/audio_pt_int.c +++ b/audio/audio_pt_int.c @@ -1,5 +1,6 @@ #include "qemu-common.h" #include "audio.h" +#include #define AUDIO_CAP "audio-pt" @@ -23,6 +24,7 @@ int audio_pt_init (struct audio_pt *p, void *(*func) (void *), { int err, err2; const char *efunc; + sigset_t set, old; p->drv = drv; @@ -38,7 +40,14 @@ int audio_pt_init (struct audio_pt *p, void *(*func) (void *), goto err1; } + sigemptyset(&set); + sigaddset(&set, SIGUSR2); + sigaddset(&set, SIGIO); + sigaddset(&set, SIGALRM); + + pthread_sigmask(SIG_BLOCK, &set, &old); err = pthread_create (&p->thread, NULL, func, opaque); + pthread_sigmask(SIG_SETMASK, &old, NULL); if (err) { efunc = "pthread_create"; goto err2;