Проблема с boost :: lockfree :: queue в разделяемой памяти (boost 1.53, gcc 4.7.2 / clang 3.0-6ubuntu3)
У меня проблема с размещениемboost::lockfree::queueconstruct(
queueName)(
m_segment->get_segment_manager());
...
m_queue->bounded_push(message);
Следующий код тоже работает правильно (но это не такиспользовать общую память):
boost::lockfree::queue q;
....
q.bounded_push(message);
Но когда я пытаюсь объединить это:
typedef boost::interprocess::allocator< MessageT,
boost::interprocess::managed_shared_memory::segment_manager>
ShmemAllocator;
typedef boost::lockfree::queue< MessageT,
boost::lockfree::allocator >
Queue;
m_segment = new boost::interprocess::managed_shared_memory(
boost::interprocess::create_only, segmentName, size);
Queue* m_queue = m_segment->construct(
queueName)(
m_segment->get_segment_manager());
...
m_queue->bounded_push(message);
он не может быть скомпилирован со следующим журналом:
In file included from src/model/Queue.h:16:
In file included from /home/uppi/lib/include/boost/lockfree/queue.hpp:24:
/home/uppi/lib/include/boost/lockfree/detail/freelist.hpp:171:28: error: no viable conversion from 'pointer' (aka 'offset_ptr') to
'boost::lockfree::queue::node *'
return Alloc::allocate(1);
~~~~~~~~~~~~~~~~~
/home/uppi/lib/include/boost/lockfree/detail/freelist.hpp:157:20: note: in instantiation of function template specialization 'boost::lockfree::detail::freelist_stack::allocate_impl' requested here
return allocate_impl();
/home/uppi/lib/include/boost/lockfree/detail/freelist.hpp:89:20: note: in instantiation of function template specialization 'boost::lockfree::detail::freelist_stack::allocate' requested here
T * node = allocate();
/home/uppi/lib/include/boost/lockfree/queue.hpp:281:34: note: in instantiation of function template specialization 'boost::lockfree::detail::freelist_stack::construct' requested here
node * n = pool.template construct(t, pool.null_handle());
/home/uppi/lib/include/boost/lockfree/queue.hpp:270:16: note: in instantiation of function template specialization 'boost::lockfree::queue::do_push' requested here
return do_push(t);
src/model/Queue.inl:4:18: note: in instantiation of member function 'boost::lockfree::queue::bounded_push' requested here
return m_queue->bounded_push(message);
/home/uppi/lib/include/boost/interprocess/offset_ptr.hpp:450:4: note: candidate function
operator unspecified_bool_type() const
Пожалуйста, скажи мне, что ям отсутствует