Opened 7 years ago
Last modified 7 years ago
#11490 new Bugs
boost::lockfree::spsc_queue::pop(T*, size_type) did not compile when used with interprocess allocator
Reported by: | Owned by: | timblechmann | |
---|---|---|---|
Milestone: | To Be Determined | Component: | lockfree |
Version: | Boost 1.58.0 | Severity: | Showstopper |
Keywords: | Cc: | pleuba@… |
Description
The method runtime_sized_ringbuffer::pop(T*, size_type) when used with interprocess allocator produces the following error when compiled with g++ 4.9.1 under linux:
/usr/local/include/boost/lockfree/spsc_queue.hpp: In instantiation of ‘boost::lockfree::detail::runtime_sized_ringbuffer<T, Alloc>::size_type boost::lockfree::detail::runtime_sized_ringbuffer<T, Alloc>::pop(T*, boost::lockfree::detail::runtime_sized_ringbuffer<T, 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::iset_index> >; boost::lockfree::detail::runtime_sized_ringbuffer<T, Alloc>::size_type = long unsigned int]’: /usr/local/include/boost/lockfree/spsc_queue.hpp:556:27: required from ‘boost::lockfree::detail::runtime_sized_ringbuffer<T, Alloc>::~runtime_sized_ringbuffer() [with T = int; Alloc = boost::interprocess::allocator<int, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> >]’ /usr/local/include/boost/lockfree/spsc_queue.hpp:679:7: required from ‘void boost::interprocess::ipcdetail::placement_destroy<T>::destroy_n(void*, std::size_t, std::size_t&) [with T = boost::lockfree::spsc_queue<int, boost::lockfree::allocator<boost::interprocess::allocator<int, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > > >; std::size_t = long unsigned int]’ spsc_queue_interprocess_test.cpp:33:1: required from here /usr/local/include/boost/lockfree/spsc_queue.hpp:609:72: error: no matching function for call to ‘boost::lockfree::detail::runtime_sized_ringbuffer<int, boost::interprocess::allocator<int, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >::pop(int*&, boost::lockfree::detail::runtime_sized_ringbuffer<int, boost::interprocess::allocator<int, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >::size_type&, boost::lockfree::detail::runtime_sized_ringbuffer<int, boost::interprocess::allocator<int, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >::pointer&, boost::lockfree::detail::runtime_sized_ringbuffer<int, boost::interprocess::allocator<int, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >::size_type&)’
return ringbuffer_base<T>::pop(ret, size, array_, max_elements_);
/usr/local/include/boost/lockfree/spsc_queue.hpp:609:72: note: candidate is: /usr/local/include/boost/lockfree/spsc_queue.hpp:263:12: note: boost::lockfree::detail::ringbuffer_base<T>::size_t boost::lockfree::detail::ringbuffer_base<T>::pop(T*, boost::lockfree::detail::ringbuffer_base<T>::size_t, T*, boost::lockfree::detail::ringbuffer_base<T>::size_t) [with T = int; boost::lockfree::detail::ringbuffer_base<T>::size_t = long unsigned int]
size_t pop (T * output_buffer, size_t output_count, T * internal_buffer, size_t max_size)
/usr/local/include/boost/lockfree/spsc_queue.hpp:263:12: note: no known conversion for argument 3 from ‘boost::lockfree::detail::runtime_sized_ringbuffer<int, boost::interprocess::allocator<int, boost::interprocess::segment_manager<char, boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family>, boost::interprocess::iset_index> > >::pointer {aka boost::interprocess::offset_ptr<int, long int, long unsigned int, 0ul>}’ to ‘int*’
I have attached a small test to reproduce the problem and a patch, but other method seems to suffer from the same problem.
Attachments (2)
Change History (6)
by , 7 years ago
Attachment: | spsc_queue_interprocess_test.cpp added |
---|
comment:1 by , 7 years ago
Cc: | added |
---|
comment:2 by , 7 years ago
3 months ago, I submitted a patch for this bug.
Can someone have a look on it and if agreed, commit it to the trunk for next release.
Philippe
Test to reproduce the problem