I am using the multiprocessing library. I would like to use a Queue-like object (meaning that it can be shared and read between processes safely) that always exposes the latest value written inside. I would like to do so without consuming the value so other processes can read the value as well.
I'm taking the example of the Queue because I only know about Pipes and Queues, but the previous values do not need to be kept like they do in those. They can be discarded.
>>> q = MyIdealQueue()
>>> q.put(0)
>>> q.put(1)
>>> q.get()
1
>>> q.get()
1
>>> q.put(2)
>>> q.get()
2
Maybe shared memory is the way to go ?