On Mon, 17 Feb 2003, Abramo Bagnara wrote:

> You're wrong: xadd is atomic but xadd/read/saturation/write is not.
> 
> Without the loop I've added you risk to write on hw_ring_buffer an *old*
> value:
> 
> A:            B:
> xadd
> read
>               xadd
>               read
>               saturate
>               write
> saturate
> write

I see, the read/saturate/write must be atomic, too. In this case, it would
be better to use a global (or a set of) mutex(es) to lock the hardware
ring buffer. The futexes are nice.

                                                Jaroslav

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



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to