private static void PlaceOrder(ITradingEngine engine, ConcurrentQueue <Order> orders) { while (orders.TryDequeue(out var order)) { engine.PlaceAsync(order); } }
private static void PlaceOrder(ITradingEngine engine, ConcurrentQueue <Order> orders) { Order order; while (orders.TryDequeue(out order)) { Console.WriteLine("PlaceAsync: " + order + " Thread: " + Thread.CurrentThread.ManagedThreadId); engine.PlaceAsync(order).GetAwaiter().GetResult(); } }