title: Thread safety std::vector push_back and reserve
body: <p>I have an application that continuously <strong>std::vector::push_back</strong> elements into a vector. As it is a real-time system I <strong>cannot afford it to stall</strong> at any time. Unfortunately, when the reserved memory is exhausted the push_back automatic memory allocation does cause stalls (up to 800ms in my measurements). </p>
  
  <p>I have tackled the problem by having a <strong>second thread</strong> that monitors when the available memory and calls a <strong>std::vector::reserve</strong> if necessary. </p>
  
  <blockquote>
    <p><strong>My question is:</strong>  is it safe to execute reserve and push_back concurrently?</p>
  </blockquote>
  
  <p>(clearly under the assumption that the push_back will not reallocate memory)</p>
  
  <p>Thanks! </p>