title: Simple Thread Synchronization
body: <p>I need a simple "one at a time" lock on a section of code.  Consider the function <code>func</code> which can be run from multiple threads:</p>
  
  <pre><code>void func()
  {
       // locking/mutex statement goes here
       operation1();
       operation2();
       // corresponding unlock goes here
       operation3();
  }
  </code></pre>
  
  <p>I need to make sure that <code>operation1</code> and <code>operation2</code> always run "together".  With C# I would use a simple <code>lock</code> block around these two calls.  What is the C++/Win32/MFC equivalent?</p>
  
  <p>Presumably some sort of <code>Mutex</code>?</p>