title: assignment operator for classes having a non copyable boost::mutex
body: <p>I am reading here this old <a href="http://boost.cppll.jp/BDTJ_1_30/libs/thread/doc/faq.html#question5" rel="nofollow">Boost Thread FAQ</a> where there is a guideline to implement copy-construction and assignment operator for classes having a <code>boost::mutex</code>non-copyable object as member. </p>
  
  <p>I am fine with the copy constructor but I have some doubt on the assignment operator. 
  Is still valid the instruction below?</p>
  
  <pre><code>  // old boost thread    
    const counter &amp; operator=( const counter&amp; other ){
       if (this == &amp;other)
          return *this;
  
       boost::mutex::scoped_lock lock1(&amp;m_mutex &lt; &amp;other.m_mutex ?
                                          m_mutex : other.m_mutex);
       boost::mutex::scoped_lock lock2(&amp;m_mutex &gt; &amp;other.m_mutex ?
                                          m_mutex : other.m_mutex);
       m_value = other.m_value;
  
       return *this;
  }
  </code></pre>
  
  <p>Should not this be updated to:</p>
  
  <pre><code> // new boost thread    
   const counter&amp; operator=(const counter&amp; other){
      if (this == &amp;other)
         return *this;
  
      boost::unique_lock&lt;boost::mutex&gt; l1(m_mutex, boost::defer_lock);
      boost::unique_lock&lt;boost::mutex&gt; l2(other.m_mutex, boost::defer_lock);
      boost::lock(l1,l2);
      m_value = other.m_value;
  
      return *this;
  }
  </code></pre>