[linux-audio-dev] lock-free data structures

Joshua Haberman joshua at reverberate.org
Fri Jun 18 03:27:43 UTC 2004


On Jun 17, 2004, at 6:00 PM, Paul Davis wrote:
>> in a lock-free way. This ensures zero-copy operation.
>
> until you want to start processing the data but keep the original
> around. i was always attached to the zero-copy model, but it just
> doesn't seem to pan out in real life.

The multiple buffer approach could provide this, no?

Your callback copies incoming data into a buffer (this much is 
unavoidable).  Then you send away a pointer to that buffer, and keep 
the pointer for yourself.  You have a "buffer pool" object that 
reference-counts all your buffers (this is possible to make lock-free 
and thread-safe), and returns buffers to a free list when the 
reference-count hits zero (also possible to make lock-free and 
thread-safe).

Josh




More information about the Linux-audio-dev mailing list