mirror of
https://github.com/farcasclaudiu/SmartThreadPool.git
synced 2026-06-22 09:01:19 +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 string _performanceCounterInstanceName = SmartThreadPool.DefaultPerformanceCounterInstanceName;
|
||||||
private bool _areThreadsBackground = SmartThreadPool.DefaultAreThreadsBackground;
|
private bool _areThreadsBackground = SmartThreadPool.DefaultAreThreadsBackground;
|
||||||
private bool _enableLocalPerformanceCounters;
|
private bool _enableLocalPerformanceCounters;
|
||||||
|
private string _threadPoolName = SmartThreadPool.DefaultThreadPoolName;
|
||||||
|
|
||||||
public STPStartInfo()
|
public STPStartInfo()
|
||||||
{
|
{
|
||||||
@@ -34,6 +35,7 @@ namespace Amib.Threading
|
|||||||
_threadPriority = stpStartInfo.ThreadPriority;
|
_threadPriority = stpStartInfo.ThreadPriority;
|
||||||
_performanceCounterInstanceName = stpStartInfo.PerformanceCounterInstanceName;
|
_performanceCounterInstanceName = stpStartInfo.PerformanceCounterInstanceName;
|
||||||
_enableLocalPerformanceCounters = stpStartInfo._enableLocalPerformanceCounters;
|
_enableLocalPerformanceCounters = stpStartInfo._enableLocalPerformanceCounters;
|
||||||
|
_threadPoolName = stpStartInfo._threadPoolName;
|
||||||
_areThreadsBackground = stpStartInfo.AreThreadsBackground;
|
_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>
|
/// <summary>
|
||||||
/// Get/Set the performance counter instance name of this SmartThreadPool
|
/// Get/Set the performance counter instance name of this SmartThreadPool
|
||||||
/// The default is null which indicate not to use performance counters at all.
|
/// The default is null which indicate not to use performance counters at all.
|
||||||
|
|||||||
@@ -161,6 +161,11 @@ namespace Amib.Threading
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default fill state with params. (false)
|
/// 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<...>
|
/// It is relevant only to QueueWorkItem of Action<...>/Func<...>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const bool DefaultFillStateWithArgs = false;
|
public const bool DefaultFillStateWithArgs = false;
|
||||||
@@ -395,7 +400,7 @@ namespace Amib.Threading
|
|||||||
|
|
||||||
private void Initialize()
|
private void Initialize()
|
||||||
{
|
{
|
||||||
Name = "SmartThreadPool";
|
Name = _stpStartInfo.ThreadPoolName;
|
||||||
ValidateSTPStartInfo();
|
ValidateSTPStartInfo();
|
||||||
|
|
||||||
// _stpStartInfoRW stores a read/write copy of the STPStartInfo.
|
// _stpStartInfoRW stores a read/write copy of the STPStartInfo.
|
||||||
|
|||||||
Reference in New Issue
Block a user