Mercurial > sdl-ios-xcode
comparison src/audio/alsa/SDL_alsa_audio.c @ 4359:4b582c04ec1d SDL-1.2
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.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Mon, 19 Oct 2009 02:36:02 +0000 |
parents | df306a61a61d |
children | be2dff2f79c0 |
comparison
equal
deleted
inserted
replaced
4358:df306a61a61d | 4359:4b582c04ec1d |
---|---|
249 }; | 249 }; |
250 | 250 |
251 /* This function waits until it is possible to write a full sound buffer */ | 251 /* This function waits until it is possible to write a full sound buffer */ |
252 static void ALSA_WaitAudio(_THIS) | 252 static void ALSA_WaitAudio(_THIS) |
253 { | 253 { |
254 /* Check to see if the thread-parent process is still alive */ | 254 /* We're in blocking mode, so there's nothing to do here */ |
255 { static int cnt = 0; | |
256 /* Note that this only works with thread implementations | |
257 that use a different process id for each thread. | |
258 */ | |
259 if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */ | |
260 if ( kill(parent, 0) < 0 ) { | |
261 this->enabled = 0; | |
262 } | |
263 } | |
264 } | |
265 } | 255 } |
266 | 256 |
267 | 257 |
268 /* | 258 /* |
269 * http://bugzilla.libsdl.org/show_bug.cgi?id=110 | 259 * http://bugzilla.libsdl.org/show_bug.cgi?id=110 |
599 ALSA_CloseAudio(this); | 589 ALSA_CloseAudio(this); |
600 return(-1); | 590 return(-1); |
601 } | 591 } |
602 SDL_memset(mixbuf, spec->silence, spec->size); | 592 SDL_memset(mixbuf, spec->silence, spec->size); |
603 | 593 |
604 /* Get the parent process id (we're the parent of the audio thread) */ | |
605 parent = getpid(); | |
606 | |
607 /* Switch to blocking mode for playback */ | 594 /* Switch to blocking mode for playback */ |
608 SDL_NAME(snd_pcm_nonblock)(pcm_handle, 0); | 595 SDL_NAME(snd_pcm_nonblock)(pcm_handle, 0); |
609 | 596 |
610 /* We're ready to rock and roll. :-) */ | 597 /* We're ready to rock and roll. :-) */ |
611 return(0); | 598 return(0); |