Есть ли проблема с этим типом реализации, чтобы дождаться завершения пакета потоков, прежде чем двигаться дальше, при следующих обстоятельствах?:
- CCR или PFX не могут быть использованы.
- Коллекция Customer.Prices и newCustomer НЕ изменяются.
- CloneCustomerPrices выполняет глубокое копирование каждой цены в коллекции Customer.Prices в новую коллекцию цен.
public List[Customer] ProcessCustomersPrices(List [Customer] Customers)
{
[Code to check Customers and deep copy Cust data into newCustomers]
List[Thread] ThreadList = new List[Thread]();
foreach(Customer cust in Customers)
{
ThreadList.Add(new Thread(() => CloneCustomerPrices(cust.Prices, newCustomer)));
}
Action runThreadBatch = () =>
{
ThreadList.ForEach(t => t.Start());
ThreadList.All (t => t.Join([TimeOutNumber]));
};
runThreadBatch(CopyPriceModelsCallback, null);
[More Processing]
return newCustomers;
}