I've tried to use boost::lockfree::spsc_queue. Occasinally found segfault, when used it with std::vector<uint16_t>. The whole type is:
spsc_queue<vector<uint16_t>, boost::lockfree::capacity<1000>> queue;
Debugging showed, that segfault happend on pop, which was organized this way:
vector<uint16_t> vec;
while(!done)
  while(quuee.pop(&vec)){ /* do staff */}
Documentation on spsc_queue says:
bool
pop(T & ret);Pops one object from ringbuffer.
But, when I use
vector<uint16_t> vec;
while(!done)
  while(quuee.pop(&vec,1)){
    /* do staff */
  }
Segfault magically disappears.
This makes me thinking, that bool pop(T&) somehow tries to restore as many items as possible.
Am I correctly use this container? Is this issue should happen to vector-like containers only? Is that staff rarely used, so it is buggy? What caveats I could face when I'm using it with vectors?
 
     
    