[bcl] Restore ThreadPool number of threads configuration after each test
authorLudovic Henry <ludovic.henry@xamarin.com>
Thu, 23 Oct 2014 15:00:12 +0000 (11:00 -0400)
committerLudovic Henry <ludovic.henry@xamarin.com>
Thu, 23 Oct 2014 15:00:47 +0000 (11:00 -0400)
mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs

index a7c006a204b48e5925f577633eae0e91d8dfa3e0..524988828b96e23defe7013539d02c1fbf604c0e 100644 (file)
@@ -104,6 +104,8 @@ namespace MonoTests.System.Threading.Tasks
                        }
                }
 
+               int workerThreads;
+               int completionPortThreads;
 
                Task[] tasks;
                const int max = 6;
@@ -111,11 +113,18 @@ namespace MonoTests.System.Threading.Tasks
                [SetUp]
                public void Setup()
                {
+                       ThreadPool.GetMinThreads (out workerThreads, out completionPortThreads);
                        ThreadPool.SetMinThreads (1, 1);
 
                        tasks = new Task[max];                  
                }
                
+               [TearDown]
+               public void Teardown()
+               {
+                       ThreadPool.SetMinThreads (workerThreads, completionPortThreads);
+               }
+               
                void InitWithDelegate(Action action)
                {
                        for (int i = 0; i < max; i++) {