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
