title: Does a lock on a mutex also apply to called functions?
body: <p>If a mutex is defined within a function, does its lock apply to functions called from that function? ie</p>
  
  <pre><code>void f () {  
      Mutex mutex;  
      g();  
  }
  </code></pre>
  
  <p>Does the lock still apply to any data modifications in g()?</p>
  
  <p>Also, am I right to say that a lock defined in a class method will only apply to specific instances of that class? Meaning:</p>
  
  <pre><code>Class Foo;  
  Foo foo1, foo2;
  (In thread 1) foo1.bar();  
  (In thread 2) foo2.bar();  
  </code></pre>
  
  <p>Would each call be able to occur concurrently?</p>
  
  <p>It would be a nice bonus if someone could explain / point out links that explain the mechanism behind mutexes. Thanks! I am currently working with the Qt Thread library, if that information helps.</p>