Assign the SmartThreadPool name in the constructor
This is required because some threads are created in the constructor, so assigning the name afterwards would be too late.0.7.4-extended
parent
39b8f339ce
commit
bb42862639
|
@ -1639,8 +1639,13 @@ namespace OpenSim.Framework
|
||||||
if (m_ThreadPool != null)
|
if (m_ThreadPool != null)
|
||||||
throw new InvalidOperationException("SmartThreadPool is already initialized");
|
throw new InvalidOperationException("SmartThreadPool is already initialized");
|
||||||
|
|
||||||
m_ThreadPool = new SmartThreadPool(2000, maxThreads, 2);
|
STPStartInfo startInfo = new STPStartInfo();
|
||||||
m_ThreadPool.Name = "Util";
|
startInfo.ThreadPoolName = "Util";
|
||||||
|
startInfo.IdleTimeout = 2000;
|
||||||
|
startInfo.MaxWorkerThreads = maxThreads;
|
||||||
|
startInfo.MinWorkerThreads = 2;
|
||||||
|
|
||||||
|
m_ThreadPool = new SmartThreadPool(startInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int FireAndForgetCount()
|
public static int FireAndForgetCount()
|
||||||
|
|
|
@ -1501,7 +1501,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
m_MaxScriptQueue = maxScriptQueue;
|
m_MaxScriptQueue = maxScriptQueue;
|
||||||
|
|
||||||
STPStartInfo startInfo = new STPStartInfo();
|
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.MaxWorkerThreads = maxThreads;
|
||||||
startInfo.MinWorkerThreads = minThreads;
|
startInfo.MinWorkerThreads = minThreads;
|
||||||
startInfo.ThreadPriority = threadPriority;;
|
startInfo.ThreadPriority = threadPriority;;
|
||||||
|
@ -1509,7 +1510,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
||||||
startInfo.StartSuspended = true;
|
startInfo.StartSuspended = true;
|
||||||
|
|
||||||
m_ThreadPool = new SmartThreadPool(startInfo);
|
m_ThreadPool = new SmartThreadPool(startInfo);
|
||||||
m_ThreadPool.Name = "XEngine";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -32,6 +32,11 @@ namespace Amib.Threading
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private ThreadPriority _threadPriority;
|
private ThreadPriority _threadPriority;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The thread pool name. Threads will get names depending on this.
|
||||||
|
/// </summary>
|
||||||
|
private string _threadPoolName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If this field is not null then the performance counters are enabled
|
/// If this field is not null then the performance counters are enabled
|
||||||
/// and use the string as the name of the instance.
|
/// and use the string as the name of the instance.
|
||||||
|
@ -46,6 +51,7 @@ namespace Amib.Threading
|
||||||
_minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads;
|
_minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads;
|
||||||
_maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads;
|
_maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads;
|
||||||
_threadPriority = SmartThreadPool.DefaultThreadPriority;
|
_threadPriority = SmartThreadPool.DefaultThreadPriority;
|
||||||
|
_threadPoolName = SmartThreadPool.DefaultThreadPoolName;
|
||||||
_pcInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName;
|
_pcInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName;
|
||||||
_stackSize = SmartThreadPool.DefaultStackSize;
|
_stackSize = SmartThreadPool.DefaultStackSize;
|
||||||
}
|
}
|
||||||
|
@ -56,6 +62,7 @@ namespace Amib.Threading
|
||||||
_minWorkerThreads = stpStartInfo._minWorkerThreads;
|
_minWorkerThreads = stpStartInfo._minWorkerThreads;
|
||||||
_maxWorkerThreads = stpStartInfo._maxWorkerThreads;
|
_maxWorkerThreads = stpStartInfo._maxWorkerThreads;
|
||||||
_threadPriority = stpStartInfo._threadPriority;
|
_threadPriority = stpStartInfo._threadPriority;
|
||||||
|
_threadPoolName = stpStartInfo._threadPoolName;
|
||||||
_pcInstanceName = stpStartInfo._pcInstanceName;
|
_pcInstanceName = stpStartInfo._pcInstanceName;
|
||||||
_stackSize = stpStartInfo._stackSize;
|
_stackSize = stpStartInfo._stackSize;
|
||||||
}
|
}
|
||||||
|
@ -84,6 +91,13 @@ namespace Amib.Threading
|
||||||
set { _threadPriority = value; }
|
set { _threadPriority = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual string ThreadPoolName
|
||||||
|
{
|
||||||
|
get { return _threadPoolName; }
|
||||||
|
set { _threadPoolName = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public string PerformanceCounterInstanceName
|
public string PerformanceCounterInstanceName
|
||||||
{
|
{
|
||||||
get { return _pcInstanceName; }
|
get { return _pcInstanceName; }
|
||||||
|
|
|
@ -135,6 +135,11 @@ namespace Amib.Threading
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const ThreadPriority DefaultThreadPriority = ThreadPriority.Normal;
|
public const ThreadPriority DefaultThreadPriority = ThreadPriority.Normal;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The default thread pool name
|
||||||
|
/// </summary>
|
||||||
|
public const string DefaultThreadPoolName = "SmartThreadPool";
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Member Variables
|
#region Member Variables
|
||||||
|
@ -143,7 +148,7 @@ namespace Amib.Threading
|
||||||
/// Contains the name of this instance of SmartThreadPool.
|
/// Contains the name of this instance of SmartThreadPool.
|
||||||
/// Can be changed by the user.
|
/// Can be changed by the user.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string _name = "SmartThreadPool";
|
private string _name = DefaultThreadPoolName;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hashtable of all the threads in the thread pool.
|
/// Hashtable of all the threads in the thread pool.
|
||||||
|
@ -307,6 +312,7 @@ namespace Amib.Threading
|
||||||
|
|
||||||
private void Initialize()
|
private void Initialize()
|
||||||
{
|
{
|
||||||
|
Name = _stpStartInfo.ThreadPoolName;
|
||||||
ValidateSTPStartInfo();
|
ValidateSTPStartInfo();
|
||||||
|
|
||||||
if (null != _stpStartInfo.PerformanceCounterInstanceName)
|
if (null != _stpStartInfo.PerformanceCounterInstanceName)
|
||||||
|
|
Loading…
Reference in New Issue