diff options
author | Greg Ward <gward@python.net> | 2003-03-11 16:53:13 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2003-03-11 16:53:13 (GMT) |
commit | 5c49ef2116a12adf93ca626343fdcd1a5cc6af08 (patch) | |
tree | 04ace5202b519b65e3f0550819dd76e6fbdca22e /Modules/ossaudiodev.c | |
parent | 315aa361fc60d3328aad3a5dcfd42f08213c25fb (diff) | |
download | cpython-5c49ef2116a12adf93ca626343fdcd1a5cc6af08.zip cpython-5c49ef2116a12adf93ca626343fdcd1a5cc6af08.tar.gz cpython-5c49ef2116a12adf93ca626343fdcd1a5cc6af08.tar.bz2 |
Open with O_NONBLOCK to avoid hanging on open().
Diffstat (limited to 'Modules/ossaudiodev.c')
-rw-r--r-- | Modules/ossaudiodev.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c index 2f4693d..0777840 100644 --- a/Modules/ossaudiodev.c +++ b/Modules/ossaudiodev.c @@ -131,7 +131,11 @@ newossobject(PyObject *arg) basedev = "/dev/dsp"; } - if ((fd = open(basedev, imode)) == -1) { + /* Open with O_NONBLOCK to avoid hanging on devices that only allow + one open at a time. This does *not* affect later I/O; OSS + provides a special ioctl() for non-blocking read/write, which is + exposed via oss_nonblock() below. */ + if ((fd = open(basedev, imode|O_NONBLOCK)) == -1) { PyErr_SetFromErrnoWithFilename(PyExc_IOError, basedev); return NULL; } |