예제 #1
0
 //Check methods in the workstaion classes: makes sure that there are ingredients ready
 public static void CheckBeef()
 {
     if (BeefBuffer.Count == 0)
     {
         for (int i = 0; i < beefLimit; i++)
         {
             lock (BeefBuffer)
             {
                 BeefBuffer.Enqueue((Beef)IngredientFactory.CreateBeef());
             }
         }
         Console.WriteLine("Putting beef on grill {0}", BeefBuffer.Count + " " + "beef was placed on grill ");
         Thread.Sleep(3000);
     }
 }
예제 #2
0
파일: Boiler.cs 프로젝트: Partast1/Threads
 //Check methods in the workstaion classes: makes sure that there are ingredients ready
 public static void Check()
 {
     if (BoilerBuffer.Count == 0)
     {
         for (int i = 0; i < boilerLimit; i++)
         {
             lock (BoilerBuffer)
             {
                 BoilerBuffer.Enqueue((Sausage)IngredientFactory.CreateSausage());
             }
         }
         Console.WriteLine("Putting sausage in boiler {0}", BoilerBuffer.Count + " " + "Sausages was placed in boiler ");
         //Thread.Sleep();
     }
 }
예제 #3
0
 //Check methods in the workstaion classes, makes sure that there are ingredients ready
 public static void CheckSausage()
 {
     if (SausageBuffer.Count == 0)
     {
         for (int i = 0; i < grillLimit; i++)
         {
             lock (SausageBuffer)
             {
                 SausageBuffer.Enqueue((Sausage)IngredientFactory.CreateSausage());
             }
         }
         Console.WriteLine("Putting sausage on grill {0}", SausageBuffer.Count + " " + "Sausages was placed on grill ");
         Thread.Sleep(3000);
     }
 }
예제 #4
0
 //Check methods in the workstaion classes: makes sure that there are ingredients ready
 public static void Check()
 {
     if (FryBuffer.Count == 0)
     {
         for (int i = 0; i < fryLimit; i++)
         {
             lock (FryBuffer)
             {
                 FryBuffer.Enqueue((Fry)IngredientFactory.CreateFries());
             }
         }
         Console.WriteLine("Putting fries in fryer {0}", FryBuffer.Count + " " + "fries was put in fryer ");
         Thread.Sleep(3000);
     }
 }