diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 6c4662cf6c..597af8222a 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1639,8 +1639,13 @@ namespace OpenSim.Framework if (m_ThreadPool != null) throw new InvalidOperationException("SmartThreadPool is already initialized"); - m_ThreadPool = new SmartThreadPool(2000, maxThreads, 2); - m_ThreadPool.Name = "Util"; + STPStartInfo startInfo = new STPStartInfo(); + startInfo.ThreadPoolName = "Util"; + startInfo.IdleTimeout = 2000; + startInfo.MaxWorkerThreads = maxThreads; + startInfo.MinWorkerThreads = 2; + + m_ThreadPool = new SmartThreadPool(startInfo); } public static int FireAndForgetCount() diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 35825d48ed..fa5382afb1 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -1501,7 +1501,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine m_MaxScriptQueue = maxScriptQueue; STPStartInfo startInfo = new STPStartInfo(); - startInfo.IdleTimeout = idleTimeout*1000; // convert to seconds as stated in .ini + startInfo.ThreadPoolName = "XEngine"; + startInfo.IdleTimeout = idleTimeout * 1000; // convert to seconds as stated in .ini startInfo.MaxWorkerThreads = maxThreads; startInfo.MinWorkerThreads = minThreads; startInfo.ThreadPriority = threadPriority;; @@ -1509,7 +1510,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine startInfo.StartSuspended = true; m_ThreadPool = new SmartThreadPool(startInfo); - m_ThreadPool.Name = "XEngine"; } // diff --git a/ThirdParty/SmartThreadPool/STPStartInfo.cs b/ThirdParty/SmartThreadPool/STPStartInfo.cs index d1815639db..fa9ceb4bb5 100644 --- a/ThirdParty/SmartThreadPool/STPStartInfo.cs +++ b/ThirdParty/SmartThreadPool/STPStartInfo.cs @@ -32,6 +32,11 @@ namespace Amib.Threading /// private ThreadPriority _threadPriority; + /// + /// The thread pool name. Threads will get names depending on this. + /// + private string _threadPoolName; + /// /// If this field is not null then the performance counters are enabled /// and use the string as the name of the instance. @@ -46,6 +51,7 @@ namespace Amib.Threading _minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads; _maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads; _threadPriority = SmartThreadPool.DefaultThreadPriority; + _threadPoolName = SmartThreadPool.DefaultThreadPoolName; _pcInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName; _stackSize = SmartThreadPool.DefaultStackSize; } @@ -56,6 +62,7 @@ namespace Amib.Threading _minWorkerThreads = stpStartInfo._minWorkerThreads; _maxWorkerThreads = stpStartInfo._maxWorkerThreads; _threadPriority = stpStartInfo._threadPriority; + _threadPoolName = stpStartInfo._threadPoolName; _pcInstanceName = stpStartInfo._pcInstanceName; _stackSize = stpStartInfo._stackSize; } @@ -84,6 +91,13 @@ namespace Amib.Threading set { _threadPriority = value; } } + public virtual string ThreadPoolName + { + get { return _threadPoolName; } + set { _threadPoolName = value; } + } + + public string PerformanceCounterInstanceName { get { return _pcInstanceName; } diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs index bd52f6245a..19a000717e 100644 --- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs +++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs @@ -135,6 +135,11 @@ namespace Amib.Threading /// public const ThreadPriority DefaultThreadPriority = ThreadPriority.Normal; + /// + /// The default thread pool name + /// + public const string DefaultThreadPoolName = "SmartThreadPool"; + #endregion #region Member Variables @@ -143,7 +148,7 @@ namespace Amib.Threading /// Contains the name of this instance of SmartThreadPool. /// Can be changed by the user. /// - private string _name = "SmartThreadPool"; + private string _name = DefaultThreadPoolName; /// /// Hashtable of all the threads in the thread pool. @@ -307,6 +312,7 @@ namespace Amib.Threading private void Initialize() { + Name = _stpStartInfo.ThreadPoolName; ValidateSTPStartInfo(); if (null != _stpStartInfo.PerformanceCounterInstanceName)