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.
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;
}
}
}
- Does this provide any benefits?
- Are there risks to removing this?