On Tue, 24 Apr 2001, Paul Davis wrote:

> >Yes, it could be implemented (and we'll implement it), but I don't
> >recommend to use it. The much better behaviour is to control the output
> >buffer (to see, how many bytes were not transmitted) rather than block a
> >process.
>
> Why ? If I try to write a large chunk of data to the parallel port, I
> expect to block. The same applies to serial ports. I don't think it

I feel, that the MIDI serial interface is like the interface for serial
ports. Please, look to these functions:

linux/drivers/char/tty_io.c:tty_write
linux/drivers/char/tty_io.c:do_tty_write
linux/drivers/char/n_tty.c:write_chan
linux/drivers/char/serial.c:rs_write

Note: Serial driver has PAGE_SIZE buffer. The serial driver behaves
exactly in the same way as the actual ALSA rawmidi driver (although the
internal ring buffer is fixed). You'll find queue operations in the tty
driver as well.

And yes, if you open the rawmidi file directly, all data written will be
commited to the wire ASAP (although they are written to the ring buffer
at first). The application blocking is questionable and I think that it's
sufficient to allow an application to do "drain" or "flush" calls or set
the O_SYNC flag.

                                                Jaroslav

-----
Jaroslav Kysela <[EMAIL PROTECTED]>
SuSE Linux    http://www.suse.com
ALSA project  http://www.alsa-project.org

Reply via email to