Beispiel #1
0
        public void BusIsComing(Bus bus)
        {
            IsBusStand = true;

            Thread enteringThread = new Thread(() =>
            {
                while (IsBusStand && Passengers.Count > 0)
                {
                    if (bus.IsDoorOpen && bus.IsSeatsExist)
                    {
                        var pass = Passengers.Dequeue();
                        bus.AddPassenger(pass);
                    }
                }
            });

            enteringThread.Start();
        }