[Python-Dev] test_ossaudiodev hanging again

Greg Ward gward@python.net
Sat, 26 Apr 2003 22:05:41 -0400

On 25 April 2003, Guido van Rossum said:
> It probably never stopped hanging.  It only runs when you pass
> "-u audio" to regrtest though.
> I note that it passes for me with Red Hat 7.3, so you might want to
> upgrade. :-)

Could be hardware, or it could be the device driver in the kernel.
Jeremy, what audio software do you use regularly -- xmms? play?
anything?  ossaudiodev currently goes to great pains to open the audio
device in what *seems* to be the right way, but I have no idea if it
really is.

(Oh yeah: it opens with O_NONBLOCK, to avoid hanging on the open() call.
Then it uses fcntl() to put the device back in blocking mode, so that
write() acts sanely.  If you really want to do non-blocking audio I/O,
you use the nonblock() method, which uses an OSS-specific ioctl().
O_NONBLOCK has no documented meaning with OSS; using it at open() time
was just a lucky guess on my part.  It does seem to affect write(), at
least with one of my audio devices.  [I have a sound card and an
external USB audio device, which makes things interesting at times.])

Greg Ward <gward@python.net>                         http://www.gerg.ca/
If you and a friend are being chased by a lion, it is not necessary to
outrun the lion.  It is only necessary to outrun your friend.