
El 19/02/2013 14:05, Tim Blechmann escribió:
hi ion,
i was wondering, what would be the best way to provide an atomic<offset_ptr>? it cannot be used out of the box, as offset_ptr does not conform to the std/boost::atomic<> requirements.
Right, it's not trivially copyable.
afaict, one would have to pre-compute the offset for a specific memory location when performing a compare_exchange or store and fix up the offset after an atomic load. to do that, it will probably be required to access some internals of the offset_ptr.
Ok maybe we need to store an atomic<OffsetType> inside atomic<offset_ptr> and add a new constructor to offset_ptr taking an address and an offset. Would that be enough?
also, if i'm going to work on it (not sure if i will have time), where shall the implementation go? in a way, i'd rather put it into interprocess than into atomic.
No problem to add atomic_offset_ptr.hpp to Interprocess. Best, Ion