Visual studio feeds

All Visual Studio blogs in one place


Enter your email address:

Delivered by FeedBurner

Increase your website traffic with



Anti-spam: How many eyes has a typical person?

Follow us on FB


Wrong Answer #2: Your own ThreadLocal

AddThis Social Bookmark Button
Originally posted at 12/15/2010Well, last time we tried to introduce a finalizer, but we forgot that we were using our own instance as the key to the slots dictionary, which prevented us from being collected, hence we never run the finalizer. All problems can be solved by adding an additional level of indirection… instead
of using our own instance, let us use a separate instance: public class CloseableThreadLocal { [ThreadStatic] public static Dictionary slots; object holder = new object(); public static Dictionary Slots { get...(Read whole news on source site)

Home : Blog List : VibrantCode : Wrong Answer #2: Your own ThreadLocal