diff options
author | EgorBo <egorbo@gmail.com> | 2017-10-06 21:50:44 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-10-19 11:54:03 +0300 |
commit | bbb109bd0380636646480736da846484de42db99 (patch) | |
tree | b45ecd8a84971ae0a309ee6189ad8eddb452c3b2 /mcs | |
parent | dbb0872f494d3a8ec40bd75856887a5c0d1af809 (diff) |
limit max possible threads in ThreadPool (SetMaxThreads). Fixes bug-60027
Diffstat (limited to 'mcs')
-rw-r--r-- | mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs b/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs index 9dace8484e5..74715403169 100644 --- a/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs +++ b/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs @@ -156,6 +156,23 @@ namespace MonoTests.System.Threading Assert.IsTrue (workerThreads == workerThreads_new, "#3"); Assert.IsTrue (completionPortThreads == completionPortThreads_new, "#4"); } + + [Test] + public void SetMaxPossibleThreads() + { + var maxPossibleThreads = 0x7fff; + int maxWt, macCpt; + + ThreadPool.SetMaxThreads(maxPossibleThreads, maxPossibleThreads); + ThreadPool.GetMaxThreads(out maxWt, out macCpt); + Assert.AreEqual(maxPossibleThreads, maxWt); + Assert.AreEqual(maxPossibleThreads, macCpt); + + ThreadPool.SetMaxThreads(maxPossibleThreads + 1, maxPossibleThreads + 1); + ThreadPool.GetMaxThreads(out maxWt, out macCpt); + Assert.AreEqual(maxPossibleThreads, maxWt); + Assert.AreEqual(maxPossibleThreads, macCpt); + } [Test] public void GetAvailableThreads () |