Re: [linux-audio-dev] Lock Free Ringbuffer in C ?

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] Lock Free Ringbuffer in C ?
From: David Olofson (david_AT_olofson.net)
Date: Sat Apr 05 2003 - 21:44:43 EEST


On Friday 04 April 2003 17.15, torbenh_AT_gmx.de wrote:
[...]
> res = sfifo_write(sf, &buf, j);
> if(res != j)
> {

DOH! Sorry, I'm in a hurry and misread your code.

Well, we're talking about a basic lock free FIFO here, based on atomic
reads and writes of two indices. Proper blocking read() and write()
would require talking to the OS scheduler one way or another (block +
wake up functionality), and that's not even possible on some of the
platforms this code is used on.

That said, I do have a version with busy-waiting versions, meant for
use with IRQs in environments without threads. I wouldn't recommend
using this on any multitasking OS, though, except possibly for IPC
across CPUs in SMP systems in some special cases.

//David Olofson - Programmer, Composer, Open Source Advocate

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`-----------------------------------> http://audiality.org -'
   --- http://olofson.net --- http://www.reologica.se ---


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Sat Apr 05 2003 - 21:43:25 EEST