Beispiel #1
0
    static void Main()
    {
        var t = new System.Threading.ThreadLocal <int>(true);

        System.Threading.Tasks.Parallel.For(0, 100000, n => { t.Value += 1; });
        System.Console.WriteLine(t.Values.Sum());
    }
Beispiel #2
0
 /// <summary>Constructs a new debugger view object for the provided ThreadLocal object.</summary>
 /// <param name="tlocal">A ThreadLocal object to browse in the debugger.</param>
 public SystemThreading_ThreadLocalDebugView(ThreadLocal <T> tlocal)
 {
     m_tlocal = tlocal;
 }