/// <summary> /// adds threads for all customers /// </summary> private void AddThreadsForAllCustomers() { foreach (var customer in Customers) { var thread = new Thread(customer.BuyItem); CustomerThreads.Add(thread); } }
/// <summary> /// Creates all customer threads /// </summary> private void CreateAllCustomerThreads() { for (var i = 0; i < AmountOfCustomers - 1; i++) { var customer = Customers[i]; var thread = new Thread(customer.BuyItem); CustomerThreads.Add(thread); } }
public void AddCustomer(string name) { ICustomer customer = _attendants.CreateCustomer(name); Customers.Add(customer); Thread thread = new Thread(() => customer.PurchaseItem()); CustomerThreads.Add(thread); }