aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorOren Hurvitz2013-01-04 08:43:05 +0200
committerJustin Clark-Casey (justincc)2013-01-19 02:08:58 +0000
commitb77da5039eba6db0f904bfa9ca0852d640436055 (patch)
treeb32659f764de2ae0845c04a7ec530ed7939cc42e
parentExplicitly stop PollServiceRequestManager() rather than relying on its destru... (diff)
downloadopensim-SC_OLD-b77da5039eba6db0f904bfa9ca0852d640436055.zip
opensim-SC_OLD-b77da5039eba6db0f904bfa9ca0852d640436055.tar.gz
opensim-SC_OLD-b77da5039eba6db0f904bfa9ca0852d640436055.tar.bz2
opensim-SC_OLD-b77da5039eba6db0f904bfa9ca0852d640436055.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Util.cs9
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs4
-rw-r--r--ThirdParty/SmartThreadPool/STPStartInfo.cs14
-rw-r--r--ThirdParty/SmartThreadPool/SmartThreadPool.cs8
4 files changed, 30 insertions, 5 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index f6c9d15..9b1e97d 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1658,8 +1658,13 @@ namespace OpenSim.Framework
1658 if (m_ThreadPool != null) 1658 if (m_ThreadPool != null)
1659 throw new InvalidOperationException("SmartThreadPool is already initialized"); 1659 throw new InvalidOperationException("SmartThreadPool is already initialized");
1660 1660
1661 m_ThreadPool = new SmartThreadPool(2000, maxThreads, 2); 1661 STPStartInfo startInfo = new STPStartInfo();
1662 m_ThreadPool.Name = "Util"; 1662 startInfo.ThreadPoolName = "Util";
1663 startInfo.IdleTimeout = 2000;
1664 startInfo.MaxWorkerThreads = maxThreads;
1665 startInfo.MinWorkerThreads = 2;
1666
1667 m_ThreadPool = new SmartThreadPool(startInfo);
1663 } 1668 }
1664 1669
1665 public static int FireAndForgetCount() 1670 public static int FireAndForgetCount()
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index a17a018..72646f6 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1486,7 +1486,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1486 m_MaxScriptQueue = maxScriptQueue; 1486 m_MaxScriptQueue = maxScriptQueue;
1487 1487
1488 STPStartInfo startInfo = new STPStartInfo(); 1488 STPStartInfo startInfo = new STPStartInfo();
1489 startInfo.IdleTimeout = idleTimeout*1000; // convert to seconds as stated in .ini 1489 startInfo.ThreadPoolName = "XEngine";
1490 startInfo.IdleTimeout = idleTimeout * 1000; // convert to seconds as stated in .ini
1490 startInfo.MaxWorkerThreads = maxThreads; 1491 startInfo.MaxWorkerThreads = maxThreads;
1491 startInfo.MinWorkerThreads = minThreads; 1492 startInfo.MinWorkerThreads = minThreads;
1492 startInfo.ThreadPriority = threadPriority;; 1493 startInfo.ThreadPriority = threadPriority;;
@@ -1494,7 +1495,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1494 startInfo.StartSuspended = true; 1495 startInfo.StartSuspended = true;
1495 1496
1496 m_ThreadPool = new SmartThreadPool(startInfo); 1497 m_ThreadPool = new SmartThreadPool(startInfo);
1497 m_ThreadPool.Name = "XEngine";
1498 } 1498 }
1499 1499
1500 // 1500 //
diff --git a/ThirdParty/SmartThreadPool/STPStartInfo.cs b/ThirdParty/SmartThreadPool/STPStartInfo.cs
index d181563..fa9ceb4 100644
--- a/ThirdParty/SmartThreadPool/STPStartInfo.cs
+++ b/ThirdParty/SmartThreadPool/STPStartInfo.cs
@@ -33,6 +33,11 @@ namespace Amib.Threading
33 private ThreadPriority _threadPriority; 33 private ThreadPriority _threadPriority;
34 34
35 /// <summary> 35 /// <summary>
36 /// The thread pool name. Threads will get names depending on this.
37 /// </summary>
38 private string _threadPoolName;
39
40 /// <summary>
36 /// If this field is not null then the performance counters are enabled 41 /// If this field is not null then the performance counters are enabled
37 /// and use the string as the name of the instance. 42 /// and use the string as the name of the instance.
38 /// </summary> 43 /// </summary>
@@ -46,6 +51,7 @@ namespace Amib.Threading
46 _minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads; 51 _minWorkerThreads = SmartThreadPool.DefaultMinWorkerThreads;
47 _maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads; 52 _maxWorkerThreads = SmartThreadPool.DefaultMaxWorkerThreads;
48 _threadPriority = SmartThreadPool.DefaultThreadPriority; 53 _threadPriority = SmartThreadPool.DefaultThreadPriority;
54 _threadPoolName = SmartThreadPool.DefaultThreadPoolName;
49 _pcInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName; 55 _pcInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName;
50 _stackSize = SmartThreadPool.DefaultStackSize; 56 _stackSize = SmartThreadPool.DefaultStackSize;
51 } 57 }
@@ -56,6 +62,7 @@ namespace Amib.Threading
56 _minWorkerThreads = stpStartInfo._minWorkerThreads; 62 _minWorkerThreads = stpStartInfo._minWorkerThreads;
57 _maxWorkerThreads = stpStartInfo._maxWorkerThreads; 63 _maxWorkerThreads = stpStartInfo._maxWorkerThreads;
58 _threadPriority = stpStartInfo._threadPriority; 64 _threadPriority = stpStartInfo._threadPriority;
65 _threadPoolName = stpStartInfo._threadPoolName;
59 _pcInstanceName = stpStartInfo._pcInstanceName; 66 _pcInstanceName = stpStartInfo._pcInstanceName;
60 _stackSize = stpStartInfo._stackSize; 67 _stackSize = stpStartInfo._stackSize;
61 } 68 }
@@ -84,6 +91,13 @@ namespace Amib.Threading
84 set { _threadPriority = value; } 91 set { _threadPriority = value; }
85 } 92 }
86 93
94 public virtual string ThreadPoolName
95 {
96 get { return _threadPoolName; }
97 set { _threadPoolName = value; }
98 }
99
100
87 public string PerformanceCounterInstanceName 101 public string PerformanceCounterInstanceName
88 { 102 {
89 get { return _pcInstanceName; } 103 get { return _pcInstanceName; }
diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
index bd52f62..19a0007 100644
--- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs
+++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
@@ -135,6 +135,11 @@ namespace Amib.Threading
135 /// </summary> 135 /// </summary>
136 public const ThreadPriority DefaultThreadPriority = ThreadPriority.Normal; 136 public const ThreadPriority DefaultThreadPriority = ThreadPriority.Normal;
137 137
138 /// <summary>
139 /// The default thread pool name
140 /// </summary>
141 public const string DefaultThreadPoolName = "SmartThreadPool";
142
138 #endregion 143 #endregion
139 144
140 #region Member Variables 145 #region Member Variables
@@ -143,7 +148,7 @@ namespace Amib.Threading
143 /// Contains the name of this instance of SmartThreadPool. 148 /// Contains the name of this instance of SmartThreadPool.
144 /// Can be changed by the user. 149 /// Can be changed by the user.
145 /// </summary> 150 /// </summary>
146 private string _name = "SmartThreadPool"; 151 private string _name = DefaultThreadPoolName;
147 152
148 /// <summary> 153 /// <summary>
149 /// Hashtable of all the threads in the thread pool. 154 /// Hashtable of all the threads in the thread pool.
@@ -307,6 +312,7 @@ namespace Amib.Threading
307 312
308 private void Initialize() 313 private void Initialize()
309 { 314 {
315 Name = _stpStartInfo.ThreadPoolName;
310 ValidateSTPStartInfo(); 316 ValidateSTPStartInfo();
311 317
312 if (null != _stpStartInfo.PerformanceCounterInstanceName) 318 if (null != _stpStartInfo.PerformanceCounterInstanceName)