title: should I synchronize the deque or not
body: <p>I have a <code>deque</code> with pointers inside in a <strong>C++</strong> application. I know there are <strong>two threads</strong> to access it. </p>
  
  <p><strong>Thread1</strong> will add pointers from the back and <strong>Thread2</strong> will process and remove pointers from the front. </p>
  
  <p>The <strong>Thread2</strong> will wait until <code>deque</code> reach certain of amount, saying 10 items, and then start to process it. It will only loop and process 10 items at a time. In the meantime, <strong>Thread1</strong> may still keep adding new items into the deque.</p>
  
  <p>I think it will be fine <strong>without synchronize</strong> the <code>deque</code> because <strong>Thread1</strong> and <strong>Thread2</strong> are accessing different part of the <code>deque</code>. It is <code>deque</code> not <code>vector</code>. So there is no case that the existing memory of the <code>container</code> will be reallocated. </p>
  
  <p>Am I right? if not, why (I want to know what I am missing)?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I know it will not hurt to ALWAYS synchronize it. But it may hurt the performance or not necessary. I just want it run faster and correctly if possible.</p>