Commit 1cd8a4e6 authored by Sam Lantinga's avatar Sam Lantinga

Recoomendation from Lennart Poettering:

I guess I don't have to mention that, but ALSA_WaitAudio() is
pure evil, and just broken. getpid() returns pids, not tids. You get
those via gettid(). But I'd recommend dropping that entirely. It's
just broken.

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%404118
parent 3070b39b
...@@ -251,17 +251,7 @@ AudioBootStrap ALSA_bootstrap = { ...@@ -251,17 +251,7 @@ AudioBootStrap ALSA_bootstrap = {
/* This function waits until it is possible to write a full sound buffer */ /* This function waits until it is possible to write a full sound buffer */
static void ALSA_WaitAudio(_THIS) static void ALSA_WaitAudio(_THIS)
{ {
/* Check to see if the thread-parent process is still alive */ /* We're in blocking mode, so there's nothing to do here */
{ static int cnt = 0;
/* Note that this only works with thread implementations
that use a different process id for each thread.
*/
if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */
if ( kill(parent, 0) < 0 ) {
this->enabled = 0;
}
}
}
} }
...@@ -601,9 +591,6 @@ static int ALSA_OpenAudio(_THIS, SDL_AudioSpec *spec) ...@@ -601,9 +591,6 @@ static int ALSA_OpenAudio(_THIS, SDL_AudioSpec *spec)
} }
SDL_memset(mixbuf, spec->silence, spec->size); SDL_memset(mixbuf, spec->silence, spec->size);
/* Get the parent process id (we're the parent of the audio thread) */
parent = getpid();
/* Switch to blocking mode for playback */ /* Switch to blocking mode for playback */
SDL_NAME(snd_pcm_nonblock)(pcm_handle, 0); SDL_NAME(snd_pcm_nonblock)(pcm_handle, 0);
......
...@@ -35,9 +35,6 @@ struct SDL_PrivateAudioData { ...@@ -35,9 +35,6 @@ struct SDL_PrivateAudioData {
/* The audio device handle */ /* The audio device handle */
snd_pcm_t *pcm_handle; snd_pcm_t *pcm_handle;
/* The parent process id, to detect when application quits */
pid_t parent;
/* Raw mixing buffer */ /* Raw mixing buffer */
Uint8 *mixbuf; Uint8 *mixbuf;
int mixlen; int mixlen;
...@@ -45,7 +42,6 @@ struct SDL_PrivateAudioData { ...@@ -45,7 +42,6 @@ struct SDL_PrivateAudioData {
/* Old variable names */ /* Old variable names */
#define pcm_handle (this->hidden->pcm_handle) #define pcm_handle (this->hidden->pcm_handle)
#define parent (this->hidden->parent)
#define mixbuf (this->hidden->mixbuf) #define mixbuf (this->hidden->mixbuf)
#define mixlen (this->hidden->mixlen) #define mixlen (this->hidden->mixlen)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment