private void Work() { while (true) { if (!_hospital.IsHasNewPatient || IsWork) { Thread.Sleep(100); continue; } _hospital.BeginInspection(); Inspection(); Consulting(); } }
private void Work() { while (!_hospital.IsDayOver) { if (!_hospital.IsHasNewPatient || IsWork) { Thread.Sleep(10); continue; } IsWork = true; var patient = _hospital.BeginInspection(); var t = DateTime.Now; Inspection(); Consulting(); var time = DateTime.Now - t; IsWork = false; _hospital.EndInspection($"Doctor {_number} has ended inspection. Common time {time.TotalMilliseconds}ms\n"); } }