From: Greg Ward Date: Fri, 4 Apr 2003 01:47:42 +0000 (+0000) Subject: Use fcntl() to put the audio device *back* into blocking mode after X-Git-Tag: v2.3c1~1288 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=76ffb1918d31bac2b88f1a63e453802248a5dfc0;p=python Use fcntl() to put the audio device *back* into blocking mode after opening it in non-blocking mode. Both Guido and David Hammerton have reported that this fixes their problems with ossaudiodev -- hooray! --- diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c index 077784088d..948ffe7e1e 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -139,6 +139,15 @@ newossobject(PyObject *arg) PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL; } + + /* And (try to) put it back in blocking mode so we get the + expected write() semantics. */ + if (fcntl(fd, F_SETFL, 0) == -1) { + close(fd); + PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); + return NULL; + } + if (ioctl(fd, SNDCTL_DSP_GETFMTS, &afmts) == -1) { PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL;