title: What's the best way to lock multiple std::mutex'es?
body: <p>Note: This question concerns C++11. The answer to the same question in C++17 (or later revisions) may have changed. For details:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/43019598/stdlock-guard-or-stdscoped-lock">std::lock_guard or std::scoped_lock?</a></li>
  </ul>
  
  <hr>
  
  <p>When we want to lock multiple <code>std::mutex</code>'es, we use <code>std::lock()</code>. But <code>std::lock()</code> does not provide RAII feature.</p>
  
  <p>When we want to lock a <code>std::mutex</code> in RAII way, we use <code>std::lock_guard</code>. But <code>std::lock_guard</code> cannot lock multiple <code>std::mutex</code>'es safely.</p>
  
  <p>Is there any way to take the advantages of both methods, to lock multiple <code>std::mutex</code>'es in RAII way?</p>