title: How does a C++ std::mutex bind to a resource?
body: <p>Does the compiler simply check which variables are being modified between the lock and unlock statements and bind them to the mutex so there is exclusive access to them?</p>
  
  <p>Or does a <code>mutex.lock()</code> lock all resources which are visible in the current scope?</p>