|
Boost : |
Subject: Re: [boost] Using boost::circular_buffer in boost::interprocess:managed_shared_memory
From: Taewan Kim (akatkim_at_[hidden])
Date: 2010-01-14 11:21:45
It works for me, too. Thank you.
Taewan
On Thu, Jan 14, 2010 at 4:30 AM, Jan Gaspar <jano_gaspar_at_[hidden]> wrote:
> Aha! Compile it with -DBOOST_CB_DISABLE_DEBUG or -DNDEBUG
>
> It just worked for me.
>
> Jan
>
>
>
> ----- Original Message ----
> From: Taewan Kim <akatkim_at_[hidden]>
> To: boost_at_[hidden]
> Sent: Wed, 13 January, 2010 21:03:06
> Subject: Re: [boost] Using boost::circular_buffer in
> boost::interprocess:managed_shared_memory
>
> It does not work, I guess, because it tries to convert offset pointer to
> void* as seen below. Can it be change to make it interprocess compliant in
> the future?
>
> Regards,
>
> Taewan
>
>
> boost_1_41_0/boost/circular_buffer/base.hpp: In member function typename
> Alloc::pointer boost::circular_buffer<T, Alloc>::allocate(typename
> Alloc::size_type) [with T = int, Alloc =
> boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> >]:
> boost_1_41_0/boost/circular_buffer/base.hpp:2087: instantiated from void
> boost::circular_buffer<T, Alloc>::initialize_buffer(typename
> Alloc::size_type) [with T = int, Alloc =
> boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> >]
> boost_1_41_0/boost/circular_buffer/base.hpp:1011: instantiated from
> boost::circular_buffer<T, Alloc>::circular_buffer(typename
> Alloc::size_type, const Alloc&) [with T = int, Alloc =
> boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> >]
> boost_1_41_0/boost/preprocessor/iteration/detail/local.hpp:40:
> instantiated from void boost::interprocess::detail::Ctor2Arg<T,
> is_iterator, P0, P1>::construct(void*, boost::interprocess::detail::false_)
> [with T = boost::circular_buffer<int, boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> > >, bool is_iterator = false, P0 = int,
> P1
> = boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> >]
> boost_1_41_0/boost/preprocessor/iteration/detail/local.hpp:40:
> instantiated from void boost::interprocess::detail::Ctor2Arg<T,
> is_iterator, P0, P1>::construct_n(void*, size_t, size_t&) [with T =
> boost::circular_buffer<int, boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> > >, bool is_iterator = false, P0 = int,
> P1
> = boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> >]
> dccircularbufferapp.cpp:151: instantiated from here
> boost_1_41_0/boost/circular_buffer/base.hpp:2014: error: cannot convert
> boost::interprocess::offset_ptr<int> to void* for argument 1 to
> void*
> memset(void*, int, size_t)
> boost_1_41_0/boost/circular_buffer/base.hpp: In member function void
> boost::circular_buffer<T, Alloc>::destroy_item(typename Alloc::pointer)
> [with T = int, Alloc = boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> >]:
> boost_1_41_0/boost/circular_buffer/base.hpp:2070: instantiated from void
> boost::circular_buffer<T, Alloc>::destroy_content() [with T = int, Alloc =
> boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> >]
> boost_1_41_0/boost/circular_buffer/base.hpp:2075: instantiated from void
> boost::circular_buffer<T, Alloc>::destroy() [with T = int, Alloc =
> boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> >]
> boost_1_41_0/boost/circular_buffer/base.hpp:1172: instantiated from
> boost::circular_buffer<T, Alloc>::~circular_buffer() [with T = int, Alloc
> =
> boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> >]
> boost_1_41_0/boost/interprocess/detail/in_place_interface.hpp:56:
> instantiated from void
> boost::interprocess::detail::placement_destroy<T>::destroy_n(void*, size_t,
> size_t&) [with T = boost::circular_buffer<int,
> boost::interprocess::allocator<int,
> boost::interprocess::segment_manager<char,
> boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family,
> boost::interprocess::offset_ptr<void>, 0ul>,
> boost::interprocess::iset_index> > >]
> dccircularbufferapp.cpp:151: instantiated from here
> boost_1_41_0/boost/circular_buffer/base.hpp:2057: error: cannot convert
> boost::interprocess::offset_ptr<int> to void* for argument 1 to
> void*
> memset(void*, int, size_t)
>
>
>
> On Wed, Jan 13, 2010 at 5:45 AM, Jan Gaspar <jano_gaspar_at_[hidden]> wrote:
>
> > Actually I never tried using circular_buffer in conjuction with
> > Interprocess library. But I think it should work. IMO the buffer obeys
> the
> > Intrprocess container rules:
> >
> > * Boost.Interprocess STL containers don't assume that memory allocated
> with
> > an allocator can be deallocated with other allocator of the same type.
> They
> > always compare allocators with operator==() to know if this is possible.
> > * The pointers of the internal structures of the Boost.Interprocess
> > containers are of the same type the pointer type defined by the allocator
> of
> > the container. This allows placing containers in managed memory segments
> > mapped in different base addresses.
> >
> >
> > Passing an interprocess allocator to the circular_buffer will make
> elements
> > (stored in the circular_buffer) to be allocated in the shared memory -
> but
> > not the circular_buffer itself. You need to create the circular_buffer in
> > the shared memory as well. Have a look at the vector example to find out
> how
> > to do it:
> >
> >
> >
> http://www.boost.org/doc/libs/1_41_0/doc/html/interprocess/allocators_containers.html#interprocess.allocators_containers.containers_explained
> >
> > Let me know if it worked.
> >
> > Regards,
> > Jan
> >
> >
> >
> >
> > ----- Original Message ----
> > From: Taewan Kim <akatkim_at_[hidden]>
> > To: boost_at_[hidden]
> > Sent: Tue, 12 January, 2010 23:11:26
> > Subject: [boost] Using boost::circular_buffer in
> > boost::interprocess:managed_shared_memory
> >
> > Can boost::circular_buffer be allocated in
> > boost::interprocess:managed_shared_memory by passing an Interprocess
> > aloocator to the constructor of boost::circular_buffer?
> > _______________________________________________
> > Unsubscribe & other changes:
> > http://lists.boost.org/mailman/listinfo.cgi/boost
> >
> >
> >
> >
> >
> > _______________________________________________
> > Unsubscribe & other changes:
> > http://lists.boost.org/mailman/listinfo.cgi/boost
> >
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
>
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk