Fix handling of negative numbers in ThreadPool.SetMin/MaxThreads (dotnet/coreclr...
authorStephen Toub <stoub@microsoft.com>
Tue, 23 Apr 2019 14:18:46 +0000 (10:18 -0400)
committerGitHub <noreply@github.com>
Tue, 23 Apr 2019 14:18:46 +0000 (10:18 -0400)
* Fix handling of negative numbers in ThreadPool.SetMin/MaxThreads

* Fix disabled test name

Commit migrated from https://github.com/dotnet/coreclr/commit/efe39f35933d89bb8f82472333810fddb78480b2

src/coreclr/src/System.Private.CoreLib/src/System/Threading/ThreadPool.CoreCLR.cs
src/coreclr/tests/CoreFX/CoreFX.issues.json

index 76eb2db..723867b 100644 (file)
@@ -208,7 +208,10 @@ namespace System.Threading
 
         public static bool SetMaxThreads(int workerThreads, int completionPortThreads)
         {
-            return SetMaxThreadsNative(workerThreads, completionPortThreads);
+            return
+                workerThreads >= 0 &&
+                completionPortThreads >= 0 &&
+                SetMaxThreadsNative(workerThreads, completionPortThreads);
         }
 
         public static void GetMaxThreads(out int workerThreads, out int completionPortThreads)
@@ -218,7 +221,10 @@ namespace System.Threading
 
         public static bool SetMinThreads(int workerThreads, int completionPortThreads)
         {
-            return SetMinThreadsNative(workerThreads, completionPortThreads);
+            return
+                workerThreads >= 0 &&
+                completionPortThreads >= 0 &&
+                SetMinThreadsNative(workerThreads, completionPortThreads);
         }
 
         public static void GetMinThreads(out int workerThreads, out int completionPortThreads)
index 7613beb..3a3a17b 100644 (file)
         }
     },
     {
+        "name": "System.Threading.ThreadPool.Tests",
+        "enabled": true,
+        "exclusions": {
+            "namespaces": null,
+            "classes": null,
+            "methods": [
+                {
+                    "name": "System.Threading.ThreadPools.Tests.ThreadPoolTests.SetMinMaxThreadsTest",
+                    "reason": "https://github.com/dotnet/corefx/issues/36885"
+                }
+            ]
+        }
+    },
+    {
         "name": "System.Memory.Tests",
         "enabled": true,
         "exclusions": {