mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 04:05:42 +08:00
Added MinPoolThreads to ini [Startup] section to control SmartThreadPool.
This commit is contained in:
@@ -1779,10 +1779,12 @@ namespace OpenSim.Framework
|
||||
FireAndForget(callback, null);
|
||||
}
|
||||
|
||||
public static void InitThreadPool(int maxThreads)
|
||||
public static void InitThreadPool(int minThreads, int maxThreads)
|
||||
{
|
||||
if (maxThreads < 2)
|
||||
throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2");
|
||||
if (minThreads > maxThreads || minThreads < 2)
|
||||
throw new ArgumentOutOfRangeException("minThreads", "minThreads must be greater than 2 and less than or equal to maxThreads");
|
||||
if (m_ThreadPool != null)
|
||||
throw new InvalidOperationException("SmartThreadPool is already initialized");
|
||||
|
||||
@@ -1790,7 +1792,7 @@ namespace OpenSim.Framework
|
||||
startInfo.ThreadPoolName = "Util";
|
||||
startInfo.IdleTimeout = 2000;
|
||||
startInfo.MaxWorkerThreads = maxThreads;
|
||||
startInfo.MinWorkerThreads = 2;
|
||||
startInfo.MinWorkerThreads = minThreads;
|
||||
|
||||
m_ThreadPool = new SmartThreadPool(startInfo);
|
||||
}
|
||||
@@ -1865,7 +1867,7 @@ namespace OpenSim.Framework
|
||||
break;
|
||||
case FireAndForgetMethod.SmartThreadPool:
|
||||
if (m_ThreadPool == null)
|
||||
InitThreadPool(15);
|
||||
InitThreadPool(2, 15);
|
||||
m_ThreadPool.QueueWorkItem((cb, o) => cb(o), realCallback, obj);
|
||||
break;
|
||||
case FireAndForgetMethod.Thread:
|
||||
|
||||
Reference in New Issue
Block a user