From 6843399e5e751e999f33de09e4476f7c96839974 Mon Sep 17 00:00:00 2001 From: Andrzej Zaborowski Date: Wed, 4 Apr 2007 15:18:20 +0200 Subject: [PATCH] Ensure signals are properly masked for new SDL Audio threads. --- audio/sdlaudio.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/audio/sdlaudio.c b/audio/sdlaudio.c index f2a6896..11edab0 100644 --- a/audio/sdlaudio.c +++ b/audio/sdlaudio.c @@ -25,6 +25,13 @@ #include #include "vl.h" +#ifndef _WIN32 +#ifdef __sun__ +#define _POSIX_PTHREAD_SEMANTICS 1 +#endif +#include +#endif + #define AUDIO_CAP "sdl" #include "audio_int.h" @@ -177,11 +184,22 @@ static int sdl_to_audfmt (int sdlfmt, audfmt_e *fmt, int *endianess) static int sdl_open (SDL_AudioSpec *req, SDL_AudioSpec *obt) { int status; +#ifndef _WIN32 + sigset_t new, old; + + /* Make sure potential threads created by SDL don't hog signals. */ + sigfillset (&new); + pthread_sigmask (SIG_BLOCK, &new, &old); +#endif status = SDL_OpenAudio (req, obt); if (status) { sdl_logerr ("SDL_OpenAudio failed\n"); } + +#ifndef _WIN32 + pthread_sigmask (SIG_SETMASK, &old, 0); +#endif return status; } -- 1.4.4.3