public void TestThreadPoolPausedAndResumed() { threadPool = new ThreadPool(Environment.ProcessorCount, "testWorker"); var wirs = new List<IWorkItemState>(); for (var i = 0; i < 10; i++) { if (i == 5) { threadPool.Sleep(); Thread.Sleep(2000); } var wir = threadPool.EnqueueWorkItem(WriteToConsole, "test " + (i + 1)); wirs.Add(wir); } threadPool.Wakeup(); foreach (var workItemState in wirs) { workItemState.Result(); workItemState.Dispose(); } threadPool.ShutDown(); }