public void Setup()
 {
     threadPool       = new MyThreadPool(numberOfThreads);
     manualResetEvent = new ManualResetEvent(false);
     results          = new ConcurrentQueue <int>();
     threads          = new Thread[numberOfThreads];
 }
 /// <summary>
 /// My task constructor.
 /// </summary>
 /// <param name="function">Task function</param>
 /// <param name="threadPool">Task thread pool</param>
 protected internal MyTask(Func <TResult> function, MyThreadPool threadPool)
 {
     if (function == null)
     {
         throw new ArgumentNullException(nameof(function));
     }
     this.threadPool = threadPool;
     this.function   = function;
 }