i remember i
have read a statement about a lock free ringbuffer
 implemented in C somewhere. 
 courtesy of paul davis:
     you should use a lock free ringbuffer. we will be adding example code
     to the example-clients directory soon. existing code is in ardour's
     source base (for C++). the example code will be in
     example-clients/capture_client.c.
 where ardour is 
ardour.sf.net. (i doubt there is anything hugely non-C in
 the ringbuffer code proper).