title: only one of multiple threads to execute a particular code path
body: <p>I have multiple threads starting at the roughly the same time --- all executing the same code path.  Each thread needs to write records to a table in a database.  If the table doesn't exist it should be created.  Obviously two or more threads could see the table as missing, and try to create it.</p>
  
  <p>What is the preferred approach to ensure that this particular block of code is executed only once by only one thread.</p>
  
  <p>While I'm writing in C# on .NET 2.0, I assume that the approach would be framework/language neutral.</p>