aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Util.cs8
-rw-r--r--OpenSim/Region/Application/OpenSim.cs4
2 files changed, 8 insertions, 4 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:
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index b071df8..9dcc8da 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -86,6 +86,7 @@ namespace OpenSim
86 IConfig startupConfig = Config.Configs["Startup"]; 86 IConfig startupConfig = Config.Configs["Startup"];
87 IConfig networkConfig = Config.Configs["Network"]; 87 IConfig networkConfig = Config.Configs["Network"];
88 88
89 int stpMinThreads = 2;
89 int stpMaxThreads = 15; 90 int stpMaxThreads = 15;
90 91
91 if (startupConfig != null) 92 if (startupConfig != null)
@@ -112,12 +113,13 @@ namespace OpenSim
112 if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod)) 113 if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse<FireAndForgetMethod>(asyncCallMethodStr, out asyncCallMethod))
113 Util.FireAndForgetMethod = asyncCallMethod; 114 Util.FireAndForgetMethod = asyncCallMethod;
114 115
116 stpMinThreads = startupConfig.GetInt("MinPoolThreads", 15);
115 stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15); 117 stpMaxThreads = startupConfig.GetInt("MaxPoolThreads", 15);
116 m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) "); 118 m_consolePrompt = startupConfig.GetString("ConsolePrompt", @"Region (\R) ");
117 } 119 }
118 120
119 if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) 121 if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
120 Util.InitThreadPool(stpMaxThreads); 122 Util.InitThreadPool(stpMinThreads, stpMaxThreads);
121 123
122 m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); 124 m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod);
123 } 125 }