title: Performance of std::mutex and QMutex in MinGW 64 (posix thread version)
body: <p>I have tried to replace <code>QMutex</code> in my application (monte carlo simulation) by <code>std::mutex</code>, and surprisingly, the computation speed was divided by 3. The mutex locking/unlocking performance cost rised from negligible to about 66% of the threads time.</p>
  
  <p>I digged into implementations sources. I initially thought that both were wrappers to Win32 threads (with an extra layer of pthread for <code>std::thread</code>), but in fact Qt is not using any kernel functions for the mutexes, and has its own internal implementation based on atomic variables. This one seems much faster.</p>
  
  <ul>
  <li>Is it really possible to fully implement a mutex with only atomic variables? Does it have limitations?</li>
  <li>Why is this not used in the STL?</li>
  <li>What would be the guidelines for fully avoiding mutexes in my case? I am accumulating (additive operations) values over floating point buffers, shared between multiple threads</li>
  </ul>
  
  <p>Thanks</p>