title: Benefits of locking a variable?
body: <p>I found the below code in our application. As per my understanding of how lock works, I cannot see how this provides any benefit, or that removing this can cause any issues.</p>
  
  <pre><code>    private static object _lockTransferInProgress = new object();
      private static volatile bool _transferInProgress = false;
      public static bool Dialer_TransferInProgress
      {
          get { return _transferInProgress; }
          set
          {
              lock (_lockTransferInProgress)
              {
                  _transferInProgress = value;
              }
          }
      }
  </code></pre>
  
  <ol>
  <li>Does this provide any benefits?</li>
  <li>Are there risks to removing this?</li>
  </ol>