mirror of
https://github.com/farcasclaudiu/SmartThreadPool.git
synced 2026-06-22 07:01:18 +03:00
CHG: threads can be named
(cherry picked from commit fbbbc451c9372af2862bc39cdf7698653c611dcf)
This commit is contained in:
committed by
Piotr Wysocki
parent
c71422756d
commit
cbb3211c12
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user