Minggu, 19 Desember 2010

Wrong answer #1: Your own ThreadLocal

Well, one way we can use to solve the problem is by introducing a finalizer, like so:public class CloseableThreadLocal{    [ThreadStatic] private static Dictionary slots;    public static Dictionary Slots    {        get { return slots ?? (slots = new Dictionary()); }    }    public /*protected internal*/ virtual Object InitialValue()    {        

Tidak ada komentar:

Posting Komentar