Beispiel #1
0
        public void ExecuteAsync(CancellationToken stoppingToken)
        {
            while (!stoppingToken.IsCancellationRequested)
            {
                var customer = queue.FirstCustomerOfQueue();

                int time = Process(customer);
                Thread.Sleep(time);

                NextAction(customer);
            }
        }
Beispiel #2
0
        public void ExecuteAsync(CancellationToken stoppingToken)
        {
            new Thread(() => Update(stoppingToken)).Start();

            while (!stoppingToken.IsCancellationRequested)
            {
                var customer = queue.FirstCustomerOfQueue();
                isBusy = true;

                customer.CreateMessage($"Processed by {Name}");
                customer.WriteToFile($"Processed by, {Name}");

                int time = Process();
                Thread.Sleep(time);

                NextAction(customer);
                isBusy = false;
            }
        }