amibar / SmartThreadPool

A .NET Thread Pool fully implemented in C# with many features
http://www.codeproject.com/Articles/7933/Smart-Thread-Pool
Microsoft Public License
507 stars 182 forks source link

STP SmartThreadPool Thread# ThreadCounter > MaxThreads Settings #31

Closed vnayak-mdsol closed 2 years ago

vnayak-mdsol commented 2 years ago

Our MaxThreads settings is set to 20. However I see that the Thread Name [STP SmartThreadPool Thread#] increase over time and is currently at STP SmartThreadPool Thread #62 We've noticed this only in our test environments.

Can you please explain under what circumstances can the ThreadCounter number be greater than the MaxThreads settings?

amibar commented 2 years ago

Hi,

You are referrung to the name of the thread. Each thread is created with a name suffixed with an incrementing counter. Threads are created and terminated as time passes and the names are not reused, so you might have a thread named Thread #1001. However, as long as the number of activate threads in an STP instance is not greater than the MaxThreads in the settings, you are ok.

Regards, Ami

vnayak-mdsol commented 2 years ago

Thank you for clarifying.