24 Nov
2014
24 Nov
'14
7:15 a.m.
On 11/11/2014 23:56, Thomas Danckaert wrote:
As far as I see, the main problem storing unique_ptr's (or any other non-copyable but moveable object), is that the code relies on a copy constructor to store objects in its internal buffer. I added an overload using a move constructor and that seems to work (though I'm quite new to multi-threading or lockfree programming, so I could be missing some potential issues).
Things get hairier for MP and MC queues (in particular objects may get copied multiple times, which can make moving unsafe), but that shouldn't be an issue for an SPSC queue, so you ought to be fairly safe.