Boost logo

Boost :

Subject: Re: [boost] [interprocess] atomic<offset_ptr>
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2013-02-19 12:15:43


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk