aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorDan Lake2013-07-18 02:28:07 -0700
committerDan Lake2013-07-18 02:28:07 -0700
commit6572847518646f3f46959f613e602efc16210dcf (patch)
tree1a541459d3224720c217592e49152a249b4f71c6 /OpenSim/Framework
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC_OLD-6572847518646f3f46959f613e602efc16210dcf.zip
opensim-SC_OLD-6572847518646f3f46959f613e602efc16210dcf.tar.gz
opensim-SC_OLD-6572847518646f3f46959f613e602efc16210dcf.tar.bz2
opensim-SC_OLD-6572847518646f3f46959f613e602efc16210dcf.tar.xz
Added MinPoolThreads to ini [Startup] section to control SmartThreadPool.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Util.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 8cfc4d4..27100e6 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1779,10 +1779,12 @@ namespace OpenSim.Framework
1779 FireAndForget(callback, null); 1779 FireAndForget(callback, null);
1780 } 1780 }
1781 1781
1782 public static void InitThreadPool(int maxThreads) 1782 public static void InitThreadPool(int minThreads, int maxThreads)
1783 { 1783 {
1784 if (maxThreads < 2) 1784 if (maxThreads < 2)
1785 throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2"); 1785 throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2");
1786 if (minThreads > maxThreads || minThreads < 2)
1787 throw new ArgumentOutOfRangeException("minThreads", "minThreads must be greater than 2 and less than or equal to maxThreads");
1786 if (m_ThreadPool != null) 1788 if (m_ThreadPool != null)
1787 throw new InvalidOperationException("SmartThreadPool is already initialized"); 1789 throw new InvalidOperationException("SmartThreadPool is already initialized");
1788 1790
@@ -1790,7 +1792,7 @@ namespace OpenSim.Framework
1790 startInfo.ThreadPoolName = "Util"; 1792 startInfo.ThreadPoolName = "Util";
1791 startInfo.IdleTimeout = 2000; 1793 startInfo.IdleTimeout = 2000;
1792 startInfo.MaxWorkerThreads = maxThreads; 1794 startInfo.MaxWorkerThreads = maxThreads;
1793 startInfo.MinWorkerThreads = 2; 1795 startInfo.MinWorkerThreads = minThreads;
1794 1796
1795 m_ThreadPool = new SmartThreadPool(startInfo); 1797 m_ThreadPool = new SmartThreadPool(startInfo);
1796 } 1798 }
@@ -1865,7 +1867,7 @@ namespace OpenSim.Framework
1865 break; 1867 break;
1866 case FireAndForgetMethod.SmartThreadPool: 1868 case FireAndForgetMethod.SmartThreadPool:
1867 if (m_ThreadPool == null) 1869 if (m_ThreadPool == null)
1868 InitThreadPool(15); 1870 InitThreadPool(2, 15);
1869 m_ThreadPool.QueueWorkItem((cb, o) => cb(o), realCallback, obj); 1871 m_ThreadPool.QueueWorkItem((cb, o) => cb(o), realCallback, obj);
1870 break; 1872 break;
1871 case FireAndForgetMethod.Thread: 1873 case FireAndForgetMethod.Thread: