When a thread pool thread is done, does stuff like Name or thread local data get reset? So when the thread comes out of the pool next time, it's like brand new?
Is there an "official" documentation on this aspect of the ThreadPool threads?
It does NOT clear thread local storage when it's released, which is the most important aspect to note.
http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx
When the thread pool reuses a thread, it does not clear the data in thread local storage or in fields that are marked with the ThreadStaticAttribute attribute. Therefore, data that is placed in thread local storage by one method can be exposed to any other method that is executed by the same thread pool thread. A method that accesses a field that is marked with the ThreadStaticAttribute attribute could encounter different data depending on which thread pool thread executes it.
This is something to be very careful about...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With