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

torbenh at gmx.de torbenh at gmx.de
Fri Apr 4 06:54:01 UTC 2003


On Fri, Apr 04, 2003 at 12:47:28PM +0200, David Olofson wrote:
> On Thursday 03 April 2003 15.36, torbenh at gmx.de wrote:
> > i remember i have read a statement about a lock free ringbuffer
> > implemented in C somewhere.
> >
> > Can anybody remeber it ?
> 
> Here's one in C; the 'sfifo':
> 
> 	http://olofson.net/mixed.html
> 
> 
> I've been using it in various environments for a few years, but that 
> doesn't guarantee anything. ;-)

well... it should for such small code :)

but how do i handle this sensibly ?


	res = sfifo_write(sf, &buf, j);
	if(res != j)
	{
		printf("Write failed!\n");

// eeek... no i dont want that...
		sleep(1);
	} else if(res)
		printf("Wrote %d\n", res);
> 
> 
> //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 ---
> 

-- 
torben Hohn
http://galan.sourceforge.net -- The graphical Audio language



More information about the Linux-audio-dev mailing list