Fix dup for /dev/dsp

Igor Pechtchanski
Mon Jul 26 01:30:00 GMT 2004

On Sat, 24 Jul 2004, Pierre A. Humblet wrote:

> At 11:52 AM 7/24/2004 +0200, Gerd Spalink wrote:
> >After reading the discussion, I agree to give archetypes a try to fix dup.
> >I'll keep a copy of the linked list solution as a reference.
> Gert,
> I have the feeling that the main reason dup doesn't work is that
> audioin_/out_ are not "new'ed" in the dup call. That means that when
> the original handle is closed, the storage will go away even though
> the child stills point to it.

That was my original theory - hence the suggestion of reference counting.
But using archetypes should work as well.

> Using an archetype will fix that, but it can probably also be fixed
> very simply without that. I was going to try that today, but I won't
> if you implement the archetype.
> What the archetype buys you is that duped handles can share
> format/bits/freq/channels info. Is that used by any application?
> I am wondering if format/bits/freq/channels should be kept separately
> for "in" and "out". The reason is that the "out" values can be modified
> on the fly by the wave header, and this shouldn't affect the "in"
> values.

FWIW, moving the format/bits/freq/channels data into the Audio_in/_out
objects will allow the reference counting solution to work (or the heavier
weight archetype one).

BTW, it is my understanding that archetypes are heavier-weight, but I'm
not quite sure about this.  I based this assumption on the fact that
archetypes were used via structure assignments, so if it's possible to use
archetypes with pointers, then they are just as lightweight as reference
      |\      _,,,---,,_
ZZZzz /,`.-'`'    -.  ;-;;,_
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski, Ph.D.
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"I have since come to realize that being between your mentor and his route
to the bathroom is a major career booster."  -- Patrick Naughton

More information about the Cygwin-patches mailing list