ring-span-lite
ring-span-lite copied to clipboard
Shared memory question?
Hey,
Your project looks promising. Can it work with shared memory? We would like to have a ring buffer between two different processes to share images and metadata
I suspect the short answer is "no"; but can you share more of your requirements?
-
Do the two processes see the ringbuffer as having the same address, or is it mapped differently in each process? For example, if Process A thinks
&buffer.front() == (void*)0x00128748, are we guaranteed that Process B thinks&buffer.front() == (void*)0x00128748, or might it happen that in Process B&buffer.front() == (void*)0x07CE8748? -
Do you require the ringbuffer itself to handle synchronization, or do you have external synchronization (e.g. a mutex)? For example, if Process A is calling
push()at the same time that Process B is callingpop(), that probably won't work, as written. -
Suppose the ringbuffer becomes completely full and then Process A tries to push onto it again. Can you assume that that's never going to happen (i.e., if it does happen, the behavior is undefined)? Or must the ringbuffer somehow support that situation? (If the latter:
ring_span_litedefinitely won't work, as written.)
[I've no experience with shared memory]
...Under Windows read/write require the use of CopyMemory(), while there's no Pusher (anymore) to get a 'handle' on writing...