public void Start(BlockPool blockPool) { Console.CancelKeyPress += Console_CancelKeyPress; this._blockPool = blockPool; _threads[0] = new Thread(blockPool.Start); _threads[0].Start(); for (int i = 1; i < _threads.Length; i++) { _threads[i] = new Thread(HashIt); _threads[i].Start(); } }
static void Main(string[] args) { string path; int size; try { Console.TreatControlCAsInput = false; HandleParametrs(args, out path, out size); var blockPool = new BlockPool(size, path); var pool = new ThreadPool(); pool.ThreadsCompleted += Pool_ThreadsCompleted; pool.Start(blockPool); } catch (Exception exc) { Console.WriteLine("{0}\n{1}", exc.Message, exc.StackTrace); Console.ReadKey(); } }