コード例 #1
0
 public void Setup()
 {
     threadPool       = new MyThreadPool(numberOfThreads);
     manualResetEvent = new ManualResetEvent(false);
     results          = new ConcurrentQueue <int>();
     threads          = new Thread[numberOfThreads];
 }
コード例 #2
0
 /// <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;
 }