CHG: threads can be named

(cherry picked from commit fbbbc451c9372af2862bc39cdf7698653c611dcf)
This commit is contained in:
Michal Staszewski
2011-06-21 14:16:50 +02:00
committed by Piotr Wysocki
parent c71422756d
commit cbb3211c12
2 changed files with 20 additions and 1 deletions
+14
View File
@@ -15,6 +15,7 @@ namespace Amib.Threading
private string _performanceCounterInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName;
private bool _areThreadsBackground = SmartThreadPool.DefaultAreThreadsBackground;
private bool _enableLocalPerformanceCounters;
private string _threadPoolName = SmartThreadPool.DefaultThreadPoolName;
public STPStartInfo()
{
@@ -34,6 +35,7 @@ namespace Amib.Threading
_threadPriority = stpStartInfo.ThreadPriority;
_performanceCounterInstanceName = stpStartInfo.PerformanceCounterInstanceName;
_enableLocalPerformanceCounters = stpStartInfo._enableLocalPerformanceCounters;
_threadPoolName = stpStartInfo._threadPoolName;
_areThreadsBackground = stpStartInfo.AreThreadsBackground;
}
@@ -95,6 +97,18 @@ namespace Amib.Threading
}
}
/// <summary>
/// Get/Set the thread pool name. Threads will get names depending on this.
/// </summary>
public virtual string ThreadPoolName {
get { return _threadPoolName; }
set
{
ThrowIfReadOnly ();
_threadPoolName = value;
}
}
/// <summary>
/// Get/Set the performance counter instance name of this SmartThreadPool
/// The default is null which indicate not to use performance counters at all.
+6 -1
View File
@@ -161,6 +161,11 @@ namespace Amib.Threading
/// <summary>
/// The default fill state with params. (false)
/// <summary>
/// The default thread pool name. (SmartThreadPool)
/// </summary>
public const string DefaultThreadPoolName = "SmartThreadPool";
/// It is relevant only to QueueWorkItem of Action<...>/Func<...>
/// </summary>
public const bool DefaultFillStateWithArgs = false;
@@ -395,7 +400,7 @@ namespace Amib.Threading
private void Initialize()
{
Name = "SmartThreadPool";
Name = _stpStartInfo.ThreadPoolName;
ValidateSTPStartInfo();
// _stpStartInfoRW stores a read/write copy of the STPStartInfo.