|
Boost : |
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2008-03-27 12:36:23
Aleksey Midenkov wrote:
> The failure is in sp_counted_impl.hpp:66:
>
> 64 template<class Ptr>
> 65 sp_counted_impl_pd(const Ptr & p, const A &a, const D &d )
> 66 : this_allocator(a), D(d), m_ptr(p.get())
> 67 {}
>
>
> p is of type offset_ptr<T> and m_ptr is of type T *
>
> Test case source, compiler output and quick fix patch (which is not fully
> correct, I suspect) are attached.
If you want to place the a shared_ptr in shared memory you must define a
deleter whose pointer type is offset_ptr because otherwise, that
shared_ptr can't be shared between processes if they map the memory in
different address. You should define the deleter storing a shared_ptr.
Anyway, I think you are using quite an old Interprocess version, because
shared_segment_deleter does not exist currently.
Download a up-to-date version from Boost SVN or the Boost 1.35 release
candidate 2. Here's a link to the documentation about shared_ptr:
http://igaztanaga.drivehq.com/interprocess/interprocess/interprocess_smart_ptr/shared_ptr.html
Regards,
Ion
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk