Ensure signals are properly masked for new SDL Audio threads, by Andrzej
Zaborowski. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3069 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
af3a903106
commit
e784ba70e0
@ -25,6 +25,13 @@
|
|||||||
#include <SDL_thread.h>
|
#include <SDL_thread.h>
|
||||||
#include "vl.h"
|
#include "vl.h"
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#ifdef __sun__
|
||||||
|
#define _POSIX_PTHREAD_SEMANTICS 1
|
||||||
|
#endif
|
||||||
|
#include <signal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define AUDIO_CAP "sdl"
|
#define AUDIO_CAP "sdl"
|
||||||
#include "audio_int.h"
|
#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)
|
static int sdl_open (SDL_AudioSpec *req, SDL_AudioSpec *obt)
|
||||||
{
|
{
|
||||||
int status;
|
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);
|
status = SDL_OpenAudio (req, obt);
|
||||||
if (status) {
|
if (status) {
|
||||||
sdl_logerr ("SDL_OpenAudio failed\n");
|
sdl_logerr ("SDL_OpenAudio failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
pthread_sigmask (SIG_SETMASK, &old, 0);
|
||||||
|
#endif
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user