qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH] Block I/O signals in audio helper threads.
Date: Fri,  6 Aug 2010 10:05:20 +0200	[thread overview]
Message-ID: <1281081920-19538-1-git-send-email-kraxel@redhat.com> (raw)

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 <kraxel@redhat.com>
---
 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 <signal.h>
 
 #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;
-- 
1.7.1

             reply	other threads:[~2010-08-06  8:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06  8:05 Gerd Hoffmann [this message]
2010-08-06  8:27 ` [Qemu-devel] Re: [PATCH] Block I/O signals in audio helper threads Paolo Bonzini
2010-08-06  9:17 ` [Qemu-devel] " malc

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1281081920-19538-1-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).