public override bool Work() { bool result = false; T job; lock (Padlock) job = pool.Pop(); if (job != null) { if (job.ReadyToRun) { result = job.Execute(); if (!result) { job.CrashCount++; } } if (job.IsFinished) { if (job.SaveOnFinish) { lock (Padlock) finished.Push(job); } else { job.Cleanup(); } } else { lock (Padlock) pool.Push(job); } } return(result); }