Beispiel #1
0
        // ConcurrentDictionary ---------------------------------------------------------------------------
        static void ConcurrentDictionaryDemo()
        {
            var      controller = new StockController();
            TimeSpan workDay    = new TimeSpan(0, 0, 1);

            Task t1 = Task.Run(() => new SalesManager("Bob").StartWork(controller, workDay));
            Task t2 = Task.Run(() => new SalesManager("Alice").StartWork(controller, workDay));
            Task t3 = Task.Run(() => new SalesManager("Rob").StartWork(controller, workDay));

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