On Mon, 17 Feb 2003, Jaroslaw Sobierski wrote: > >> 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. > > > >They are nice indeed, but definitely not the right solution here. > > > >Although I don't know if it's the absolute best solution, the 'retry' > >approach I've proposed is far better and much more efficient. > > I have to agree with Abramo. A global mutex would cause long and unnecessary > waits for the processes trying to write to the plugin. Locking access to > individual parts of the buffer is messy. Notice that concurrent writes > to the same sample in the buffer will occur sporadically, and the "re-read" > in the loop costs almost nothing, while synchronization mechanisms could > block often.
Note that your all nice ideas go to some blind alley. Who will silence the sum buffer? Driver silences only hardware buffer which will not be used for the calculation in your algorithm. 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