public void Run() { Console.WriteLine("Test #{0}, Accounts ({1}), OPS = {2}", TestNumber, string.Join(",", _accounts), _ordersPerSec); // new barier with _accounts.Count participants + this thread TradeExample.Barrier = new Barrier(_accounts.Count + 1); foreach (var account in _accounts) { TradeExample trade = new TradeExample(_server, account, _password, _ordersPerSec, _ordersPersist, _stopAfterTime); trade.Run(); TradeTests.Add(trade); } // signal to start trading TradeExample.Barrier.SignalAndWait(); // waiting for accounts stop trading TradeExample.Barrier.SignalAndWait(); TradeTests.ForEach(t => t.Dispose()); }