[linux-audio-dev] Behaviour of write() in blocking/non-blocking mode

Greg Ward gward at python.net
Fri Nov 29 12:39:00 UTC 2002

On 29 November 2002, guenter geiger said:
> You can rely on the fact that blocking write will write the whole
> buffer to the sound device. (Unless something bad happens).

Ahh, OK thanks.  That's a bit different from the conventional semantics
for blocking write(), but that's no big deal.  Just more work for OSS
driver writers and less work for application writers.

Two more questions though: what is "something bad", and if it happens,
will write() just return early without consuming the whole buffer, or
will it return -1 to indicate an error?

> For non-blocking mode, you can rely that the call will return immediatly
> instead of waiting to be able to write the rest of the buffer.

That is what I would expect and what I have observed.

Thanks --

Greg Ward <gward at python.net>                         http://www.gerg.ca/
Pointers are Arrays; Code is Data; Time is Money

More information about the Linux-audio-dev mailing list