Example #1
0
        static void Main(string[] args)
        {
            StockController controller = new StockController();

            TimeSpan workDay = new TimeSpan(0, 0, 0, 0, 500);
            Task     task1   = Task.Run(() => new SalesPerson("Kim").Work(workDay, controller));
            Task     task2   = Task.Run(() => new SalesPerson("Tim").Work(workDay, controller));

            Task.WaitAll(task1, task2);

            controller.DisplayStatus();
        }
Example #2
0
        static void Main()
        {
            StockController controller = new StockController();
            TimeSpan workDay = new TimeSpan(0, 0, 2);

            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();
        }
Example #3
0
        static void Main(string[] args)
        {
            StockController controller = new StockController();
            TimeSpan        workDay    = new TimeSpan(0, 0, 2);

            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();
        }