All of lore.kernel.org
 help / color / mirror / Atom feed
[parent not found: <3D98769A000FAA05@ims5a.libero.it>]
[parent not found: <200209171301.g8HD1Ww01231@mother.ludd.luth.se>]
[parent not found: <3D8638F6.AC6DE0C2@racine.ra.it>]
* Re: Why do I get broken pipe on write to a pcm in state PREPARED?
@ 2002-09-13  9:41 Jaroslav Kysela
  2002-09-15 17:56 ` Why do I get broken pipe on write to a pcm in statePREPARED? Abramo Bagnara
  0 siblings, 1 reply; 49+ messages in thread
From: Jaroslav Kysela @ 2002-09-13  9:41 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Anders Torger, alsa-devel@lists.sourceforge.net

On Thu, 12 Sep 2002, Takashi Iwai wrote:

> At Thu, 12 Sep 2002 13:48:56 +0200,
> Anders Torger wrote:
> > 
> (...snipped the analogy of pipes...)
> > 
> > Well, I have the same opinion, I'd just like to give another example 
> > (actually the same all over again, but I want to make it obvious). For 
> > a socket or a pipe, if noone reads from the other end, it will block 
> > forever. Thus, a buggy program will dead-lock. I think this example 
> > fits logically the case of writing to the sound-card but no-one starts 
> > it. It should then block forever.
>  
> agreed, although the alsa is already apart from the standard device
> operations (unlike normal devices, alsa needs an explicit set-up
> before read/write).
> 
> 
> > The problem I have is that I do not see the use of generating a broken 
> > pipe in this situation, the only scenario I can come up with is "oh, I 
> > got a broken pipe, I must have forgotten to start the pcm, so I do it 
> > and try writing again". But that scenario is highly unlikely to occur 
> > in a program, and if it does, I would call it bad programming.
> > 
> > For the blocking case, however, there is a use, that of having multiple 
> > threads (or forked processes). In my case I have a input thread and and 
> > output thread, and the sound-card is started from the input thread, 
> > after the output buffer has been readily filled with data. Not that it 
> > is hard to change my program to do like ALSA wants it, but I think the 
> > behaviour is wrong, it is not what one would expect.
> 
> we can see this problem from a different angle:  on the current
> scheme, you cannot block writing if the stream is not running.
> writing more in the prepare state will always return an error
> immediately.
> 
> btw, the attached patch is a quick and untested hack to change the
> behavior as you wish :)
> please give a try.

I think that the current behaviour of write() is ok, the behaviour of
poll() might be "fixed". I see advantages for both. I would prefer to have
this configurable to satisfy multi-threaded applications. We can put a new
variable to sw_params.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project  http://www.alsa-project.org
SuSE Linux    http://www.suse.com



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

^ permalink raw reply	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2002-10-10 15:03 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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         ` Why do I get broken pipe on write to a pcminstatePREPARED? Abramo Bagnara
2002-10-09 19:33           ` Jaroslav Kysela
     [not found] <3D98769A000FAA05@ims5a.libero.it>
2002-10-05  7:45 ` Why do I get broken pipe on write to a pcm in statePREPARED? Abramo Bagnara
     [not found] <200209171301.g8HD1Ww01231@mother.ludd.luth.se>
2002-09-17 13:04 ` Anders Torger
     [not found] <3D8638F6.AC6DE0C2@racine.ra.it>
2002-09-16 22:04 ` Tim Goetze
2002-09-17  8:21   ` Abramo Bagnara
2002-09-17  9:21     ` Tim Goetze
2002-09-13  9:41 Why do I get broken pipe on write to a pcm in state PREPARED? Jaroslav Kysela
2002-09-15 17:56 ` Why do I get broken pipe on write to a pcm in statePREPARED? Abramo Bagnara
2002-09-16 10:46   ` Takashi Iwai
2002-09-16 13:18     ` Tim Goetze
2002-09-16 14:31       ` Takashi Iwai
2002-09-16 19:31     ` Abramo Bagnara
2002-09-16 19:49       ` Tim Goetze
2002-09-16 20:14       ` Anders Torger
2002-09-17  8:12         ` Abramo Bagnara
2002-09-17  9:03           ` Anders Torger
2002-09-17 13:04           ` Paul Davis
2002-09-17  9:05         ` Clemens Ladisch
2002-09-17 10:09           ` Anders Torger
2002-09-17 11:09           ` Takashi Iwai
2002-09-17 11:55             ` tomasz motylewski
2002-09-17 12:52               ` Takashi Iwai
2002-09-17 13:01                 ` Anders Torger
2002-09-17 14:40                   ` Clemens Ladisch
2002-09-18 19:57                     ` Anders Torger
2002-10-04  8:14                       ` Anders Torger
2002-10-04 12:58                         ` Takashi Iwai
2002-10-04 18:04                           ` Abramo Bagnara
2002-10-07 10:15                             ` Takashi Iwai
2002-10-07 12:07                               ` Abramo Bagnara
2002-10-07 13:19                                 ` Anders Torger
2002-10-07 17:46                                   ` Abramo Bagnara
2002-10-08  9:54                                     ` Takashi Iwai
2002-10-07 13:57                                 ` Tim Goetze
2002-10-09 18:13                             ` Jack O'Quin
2002-09-17 13:03           ` Paul Davis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.