public static void JoeWorker() { RobotJoe joe = new RobotJoe(); while (true) { if (filling <= 1900) { while (filling < 2000) { filling += joe.Fill(); } } if (flavor <= 1900) { while (flavor < 2000) { flavor += joe.Fill(); } } if (topping <= 1900) { while (topping < 2000) { topping += joe.Fill(); } } Thread.Sleep(rand.Next(0, 50)); } }
static void JoeTask(CancellationToken token) { RobotJoe joe = new RobotJoe(locking, fillinghopper, flavorhopper, toppinghopper, hopperevent, lucyevent); joe.DoWork(token); }