title: boost scoped_lock vs plain lock/unlock
body: <p>I'm going to use <code>boost::mutex</code> from <code>boost/thread/mutex.hpp</code>.
  There are several ways to lock/unlock mutex: with <code>scoped_lock</code>, <code>unique_lock</code>, <code>lock_guard</code>, mutex's member functions <code>::lock()</code> and <code>::unlock()</code> and nonmember functions <code>lock()</code> and <code>unlock()</code>.</p>
  
  <p>I noticed, that <code>boost::scoped_mutex</code> is one of the most popular ways of using mutex. Why is it preferable to member functions <code>::lock()</code> and <code>::unlock()</code>?</p>
  
  <p>Particularly, why should I use</p>
  
  <pre><code>{
    boost::scoped_lock lock(mutex)
    // ...
    // read/output sharing memory.
    // ...
  }
  </code></pre>
  
  <p>rather than</p>
  
  <pre><code>mutex.lock()
  // ...
  // read/output sharing memory.
  // ...
  mutex.unlock()
  </code></pre>
  
  <p>is <code>scoped_lock</code> better just because of some style-coding point of view or is <code>::lock()/::unlock()</code> not "thread safe enough"?</p>