2 using System.Threading;
3 using System.Reflection;
9 static bool tfailed = true;
11 static void thread () {
15 Console.WriteLine ("start value: {0}", var);
16 for (int i = 0; i < 10; ++i) {
20 Console.WriteLine ("end value: {0}", var);
28 Thread thr = new Thread (new ThreadStart (thread));
33 Console.WriteLine ("value in main thread: {0}", var);
35 Console.WriteLine ("value in main thread after join: {0}", var);
44 /* Test access though reflection */
46 FieldInfo fi = typeof (T).GetField ("var", BindingFlags.NonPublic|BindingFlags.Static);
47 if ((int)fi.GetValue (null) != 42)
49 fi.SetValue (null, 43);