On Sat, 6 Mar 2004, Adam Tla/lka wrote:

> On Sat, Mar 06, 2004 at 11:59:45AM +0100, Jaroslav Kysela wrote:
> > On Sat, 6 Mar 2004, Giuliano Pochini wrote:
> > 
> > > On the Echoaudio cards the sample rate is a global setting, so I need a way
> > > to prevent an app to change the rate if someone else already set it (the
> > > card han several devices/subdevices). I was thinking to put a simple
> > > "if (IsAudioOpen()) rate_min=rate_max=current_rate;" in pcm_open callback,
> > > but this solution is racy.
> Talking about race conditions you could use a variable which is set to 0
> at the beginning. Now if app wants to set a rate it does atomic compare
> and increase (cmpxchg on  x86) instruction so only one app could set
> rate. The other could only read memorized rate settins and report an
> error if rate is different.

We have already a number of locking features in kernel (spinlocks, 
mutexes, atomic integer operations, atomic bitmap operations etc).

                                                Jaroslav

-----
Jaroslav Kysela <[EMAIL PROTECTED]>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to