Пример #1
0
 public Barbershop()
 {
     for (int i = 0; i < chairsCount; i++)
     {
         chairs[i] = new Chair();
     }
 }
Пример #2
0
        private void Chill()
        {
            if (!barbershop.IsAlreadySeat(this))
            {
                lock (barbershop.FindChairLocker)
                {
                    Chair = barbershop.FindFreeChair(false);
                    var tookFreeChair = Chair?.TrySeat(this) ?? false;
                    if (tookFreeChair)
                    {
                        Logger.Write($"{Name} занял свободное кресло и отдыхает");
                    }
                }
            }

            Thread.Sleep(50);
        }