Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Abramo Bagnara <abramo.bagnara@libero.it>
To: Clemens Ladisch <clemens@ladisch.de>
Cc: Paul Davis <pbd@op.net>, Anders Torger <torger@ludd.luth.se>,
	alsa-devel@lists.sourceforge.net, Takashi Iwai <tiwai@suse.de>,
	Jaroslav Kysela <perex@perex.cz>
Subject: Re: Why do I get broken pipe on write to a pcminstatePREPARED?
Date: Wed, 09 Oct 2002 20:53:20 +0200	[thread overview]
Message-ID: <3DA47B20.4F880B4D@libero.it> (raw)
In-Reply-To: Pine.HPX.4.33n.0210090843120.2463-100000@studcom.urz.uni-halle.de

Clemens Ladisch wrote:
> 
> The current behaviour for playback is:
> 
> PREPARED: return POLLOUT until the buffer is full, then return POLLERR
> RUNNING: block until avail_min can be written, then return POLLOUT
> DRAINING: block (until state changes)
> (other states: POLLERR)
> 
> I want the behaviour in the PREPARED state to be similar to the RUNNING
> state, i.e. return POLLOUT until the buffer is full, then block.

Please reread with me SusV3:

POLLOUT: Normal data may be written without blocking.

When buffer is not full we have to return POLLOUT, but when buffer is
full the point is *not* that file cannot be written without blocking,
the point is that file cannot be written (because we'd return an error)

See?

Now the point is another: it's correct to return an error when buffer is
full or it's better to block?

My answer is that proposed behaviour is illogical if the programmer take
in account single-threading (i.e. my application have exclusive control
of PCM):
- in blocking mode we should delay (waiting for what?)
- in nonblocking mode we should return -EAGAIN (why try again?)

OTOH I agree that if the programmer consider multi-threading all the
illogicity goes away.

I think this could be faced with an appropriate documentation.

I've still some residual doubts:
- how many applications out there we will break?
- I'm almost sure that alsa-lib need to be changed in several places to
follow this: who will do that? I'm thinking expecially to PCM chains and
pcm_share.

Ok, iff:
- Jaroslav agrees too
- somebody do the patch for write *and* poll, correct the documentation
and add a special paragraph explaining multithreading POV, correct
alsa-lib and test *all* the PCM classes

you'll have my vote (FWIW of course ;-).

Thanks for your patience anyway.

-- 
Abramo Bagnara                       mailto:abramo.bagnara@libero.it

Opera Unica                          Phone: +39.546.656023
Via Emilia Interna, 140
48014 Castel Bolognese (RA) - Italy


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf

  parent reply	other threads:[~2002-10-09 18:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <3D98769A00183382@ims5a.libero.it>
2002-10-08  6:06 ` Why do I get broken pipe on write to a pcm in statePREPARED? Abramo Bagnara
2002-10-08  7:30   ` Clemens Ladisch
2002-10-08 18:50     ` Why do I get broken pipe on write to a pcm instatePREPARED? Abramo Bagnara
2002-10-09  7:52       ` Clemens Ladisch
2002-10-09 10:48         ` Anders Torger
2002-10-09 18:54           ` Abramo Bagnara
2002-10-09 13:28         ` James Courtier-Dutton
2002-10-09 13:54           ` Anders Torger
2002-10-10  2:15             ` James Courtier-Dutton
2002-10-10  3:51               ` Anders Torger
2002-10-10 14:21                 ` Jaroslav Kysela
2002-10-10 15:03                   ` Anders Torger
2002-10-09 14:39           ` Tim Goetze
2002-10-09 18:53         ` Abramo Bagnara [this message]
2002-10-09 19:33           ` Why do I get broken pipe on write to a pcminstatePREPARED? Jaroslav Kysela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3DA47B20.4F880B4D@libero.it \
    --to=abramo.bagnara@libero.it \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=clemens@ladisch.de \
    --cc=pbd@op.net \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    --cc=torger@ludd.luth.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox