title: Standard way to make STL objects threadsafe?
body: <p>I need several STL containers, threadsafe.</p>
  
  <p>Basically I was thinking I just need 2 methods added to each of the STL container objects,</p>
  
  <pre><code>.lock()
  
  .unlock()
  </code></pre>
  
  <p>I could also break it into</p>
  
  <pre><code>.lockForReading()
  .unlockForReading()
  .lockForWriting()
  .unlockForWriting()
  </code></pre>
  
  <p>The way that would work is any number of locks for parallel reading are acceptable, but if there's a lock for writing then reading AND writing are blocked.</p>
  
  <p>An attempt to lock for writing waits until the lockForReading semaphore drops to 0.</p>
  
  <p>Is there a standard way to do this?</p>
  
  <p>Is how I'm planning on doing this wrong or shortsighted?</p>