# HG changeset patch # User Sam Lantinga # Date 994693601 0 # Node ID 799bea5504e2de05258098723d449e1ae0998e2c # Parent d84a06e0c35815c07b0da1c5d445a3df64b07b9b Fixed blocking open bug when using blocking audio writes diff -r d84a06e0c358 -r 799bea5504e2 src/audio/dsp/SDL_dspaudio.c --- a/src/audio/dsp/SDL_dspaudio.c Sun Jul 08 09:03:47 2001 +0000 +++ b/src/audio/dsp/SDL_dspaudio.c Mon Jul 09 15:46:41 2001 +0000 @@ -58,11 +58,7 @@ /* Open the audio device for playback, and don't block if busy */ #define USE_BLOCKING_WRITES -#ifdef USE_BLOCKING_WRITES -#define OPEN_FLAGS O_WRONLY -#else #define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) -#endif /* Audio driver functions */ static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec); @@ -339,6 +335,18 @@ } mixbuf = NULL; +#ifdef USE_BLOCKING_WRITES + /* Make the file descriptor use blocking writes with fcntl() */ + { long flags; + flags = fcntl(audio_fd, F_GETFL); + flags &= ~O_NONBLOCK; + if ( fcntl(audio_fd, F_SETFL, flags) < 0 ) { + SDL_SetError("Couldn't set audio blocking mode"); + return(-1); + } + } +#endif + /* Get a list of supported hardware formats */ if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) { SDL_SetError("Couldn't get audio format list");