# HG changeset patch # User Sam Lantinga # Date 1255919762 0 # Node ID 4b582c04ec1da7b543432d7b2eba9e9410e9bb68 # Parent df306a61a61d785ddbb2f7e2c4d53623e73c5ba6 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. diff -r df306a61a61d -r 4b582c04ec1d src/audio/alsa/SDL_alsa_audio.c --- a/src/audio/alsa/SDL_alsa_audio.c Mon Oct 19 02:33:07 2009 +0000 +++ b/src/audio/alsa/SDL_alsa_audio.c Mon Oct 19 02:36:02 2009 +0000 @@ -251,17 +251,7 @@ /* This function waits until it is possible to write a full sound buffer */ static void ALSA_WaitAudio(_THIS) { - /* Check to see if the thread-parent process is still alive */ - { 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; - } - } - } + /* We're in blocking mode, so there's nothing to do here */ } @@ -601,9 +591,6 @@ } 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 */ SDL_NAME(snd_pcm_nonblock)(pcm_handle, 0); diff -r df306a61a61d -r 4b582c04ec1d src/audio/alsa/SDL_alsa_audio.h --- a/src/audio/alsa/SDL_alsa_audio.h Mon Oct 19 02:33:07 2009 +0000 +++ b/src/audio/alsa/SDL_alsa_audio.h Mon Oct 19 02:36:02 2009 +0000 @@ -35,9 +35,6 @@ /* The audio device handle */ snd_pcm_t *pcm_handle; - /* The parent process id, to detect when application quits */ - pid_t parent; - /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; @@ -45,7 +42,6 @@ /* Old variable names */ #define pcm_handle (this->hidden->pcm_handle) -#define parent (this->hidden->parent) #define mixbuf (this->hidden->mixbuf) #define mixlen (this->hidden->mixlen)