Quick question:
Is this valid, or am I missing a potential deadlock in the future:
static readonly object _LockThis = new object();
private static bool _Status;
private bool Status
{
get { lock (_LockThis) { return _Status; } }
set { lock (_LockThis) { _Status = value; } }
}
private void Work()
{
while (Status)
{
//do some work
}
}
private void StopWorking()
{
Status = false;
}
private void StartWorking()
{
Status = true;
Thread WorkThread = new Thread(Work);
WorkThread.Start();
StopWorking();
}