I'd like to use a spsc_queue of unique_ptr's to bigger objects, to
transfer ownership between threads. That way, I can create/allocate an
object in a non-realtime thread, then transfer ownership to a realtime
thread using a lockfree queue, and, using another queue, pass on the
unique_ptr to another thread that takes care of cleanup when the
realtime thread no longer needs the it.
For example:
boost::lockfree::spsc_queue > cb;
Unfortunately, spsc_queue does not use move semantics (methods to push
onto the queue take parameters as const reference and construct a copy
in the queues internal storage), so i can not cb.push() a
unique_ptr<string> onto my queue. Is it reasonable to want to add
this, and if so, what would be the best place to submit a request? (I
managed to get a simple example working by adding rvalue reference
overrides of the queue's push() methods, and using std::move in the
pop() method)
bool push(T && t) { };
Also, I noticed that the destructor for the spsc_queue (with size
fixed at compile-time) does not run destructors for it's contents.
What could be the reason for this?
Thomas