Recently I have seen this code in a WebSite, and my question is the following:
private bool mbTestFinished = false;
private bool IsFinished()
{
lock( mLock )
{
return mbTestFinished;
}
}
internal void SetFinished()
{
lock( mLock )
{
mbTestFinished = true;
}
}
In a multithread environment, is really necessary to lock the access to the mbTestFinished
?