Skip to content

Theraot.Threading.TrackingThreadLocal

Alfonso J. Ramos edited this page Nov 10, 2015 · 2 revisions

TrackingThreadLocal<T>

This class is the tracking backend for ThreadLocal. The internal implementation uses SafeDictionary<Thread, INeedle<T>> this means that:

  • The values are available after the thread to which they belong has ended.
  • It is possible to iterate over the values for all the threads.

NoTrackingThreadLocal<T> in addition offers:

  • TryGetValue will only return the value for the current thread if it has been already created. There is an overload to get the value of another thread.
  • EraseValue uncreates the value for the current thread.