예제 #1
0
        static void Main(string[] args)
        {
            StockController controller = new StockController();
            TimeSpan        workDay    = new TimeSpan(0, 0, 2);//2 secs per day

            Task t1 = Task.Run(() => new SalesPerson("Sahil").Work(controller, workDay));
            Task t2 = Task.Run(() => new SalesPerson("Peter").Work(controller, workDay));
            Task t3 = Task.Run(() => new SalesPerson("Juliette").Work(controller, workDay));
            Task t4 = Task.Run(() => new SalesPerson("Xavier").Work(controller, workDay));

            Task.WaitAll(t1, t2, t3, t4);
            controller.DisplayStatus();
        }