private void LandAfterWaiting(IStation station, Plane plane) { lock (station.Locker) { if (IsFirstWaiterPlane(station, plane)) //check if its thread first time. { simulatorService.RemoveWaiterFromStations(plane, LandingRunways.Cast <IStation>()); //remove plane from station waiters list. LandingRunwayStation rws = station as LandingRunwayStation; Land(plane, rws); LandingWaiters.Remove(plane); Task.Run(() => ContinueMovement(plane, rws)); //Run it in another thread so other threads will execute. } } }
private LandingRunwayStation GetRunwayToLand() => LandingRunways.FirstOrDefault(r => r.CurrentPlane == null);
private RunwayStation GetRunwayToLand() { //All the logic of when and where to land goes here return(LandingRunways.FirstOrDefault(r => r.CurrentPlane == null)); }