title: Strange behavior of a static class
body: <p>I have a system that can be lock by multiple reasons.<br>
  Here is the static class, in charge of keeping the lock states:</p>
  
  <pre><code>internal static class Locker
  {
      private static ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
      internal static bool LockedByReason1 { get; set; }
      internal static bool LockedByReason2 { get; set; }
      internal static bool LockedByReason3 { get; set; }
  
      internal static bool Locked
      {
          get
          {
              log.DebugFormat("LockedByReason1: {0}, LockedByReason2: {1}, LockedByReason3: {2}", LockedByReason1, LockedByReason2, LockedByReason3);
              return LockedByReason1 || LockedByReason2 || LockedByReason3;
          }
      }
  }
  </code></pre>
  
  <p>This is the code in the business logic:</p>
  
  <pre><code>Locker.LockedByReason1 = false;
  if (Locker.Locked)
      log.Info("Unlocking system...");
  else
      log.Info("Not unlocking system");
  </code></pre>
  
  <p>My log file show this text:</p>
  
  <pre><code>2014-06-06 10:54:31,765 DEBUG Client.Utils.Locker - LockedByReason1: False, LockedByReason2: False, LockedByReason3: False
  2014-06-06 10:54:31,765 INFO Client.BusinessLogicManager - Not unlocking system
  </code></pre>
  
  <p>As you can see, the setting of the <code>LockedByReason1</code> property and querying the <code>Locked</code> state were called at the same time.<br>
  Do I have here a race condition problem?<br>
  Is it because the <code>Locker</code> class is static?</p>