title: locking static variable
body: <p>I have a following class at server-side. </p>
  
  <pre><code>public class Sample
  {
      private enum Status
      {
          NotEvaluated,
          Yes,
          No
      }
  
      private static object _lockObj = new object();
      private static Status _status = Status.NotEvaluated;
  
      public static Status GetStatus()
      {
          if (_status == Status.NotEvaluated)
          {
              lock (_lockObj)
              {
                  if (_status == Status.NotEvaluated)
                  {
                      //some evaluation code which sets status to either Yes/No;
                      _status = Status.Yes;
                  }
              }
          }
  
          return _status;
      }
  
  }
  </code></pre>
  
  <p>Is anything wrong in locking mechanism above? do i need to lock at all? Because it is server-side (multiple requests will be there) and the variable is static i would think it should be locked at the time of evaluation.</p>
  
  <p>correct me if i am wrong.</p>
  
  <p>Thanks</p>