title: Including std::lock_guard in extra scope
body: <p>Does is make sense to do something like putting a <code>std::lock_guard</code> in an extra scope so that the locking period is as short as possible?</p>
  
  <p><strong>Pseudo code:</strong></p>
  
  <pre><code>// all used variables beside the lock_guard are created and initialized somewhere else
  ...// do something
  
  { // open new scope
      std::lock_guard&lt;std::mutex&gt; lock(mut);
      shared_var = newValue;  
  } // close the scope
  
  ... // do some other stuff (that might take longer)
  </code></pre>
  
  <p>Are there more advantages besides having a short lock duration?</p>
  
  <p>What might be negative side effects?</p>