示例#1
0
        public void DynamicThreadPoolFillUpToWork()
        {
            TestContext.WriteLine("Test trace message");

            using (DynamicThreadPool testInst = new DynamicThreadPool(0, 4 * Environment.ProcessorCount, 1000, "name"))
            {
                Assert.AreEqual(0, testInst.ActiveThreadCount);

                testInst.FillPoolUpTo(Environment.ProcessorCount);
                Assert.AreEqual(Environment.ProcessorCount, testInst.ActiveThreadCount);
                Assert.AreEqual(Environment.ProcessorCount, testInst.ThreadCount);

                testInst.FillPoolUpTo(4 * Environment.ProcessorCount);
                Assert.AreEqual(4 * Environment.ProcessorCount, testInst.ThreadCount);
            }
        }