Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / tests / generic-special.2.cs
1 using System;
2 using System.Threading;
3
4 public class IntClass {
5         public int i;
6
7         public IntClass (int val) { i = val; }
8
9         public int get () { return i; }
10 }
11
12 public class Gen<T> {
13         [ThreadStaticAttribute]
14         static T field;
15
16         public static void setField (T t) { field = t; }
17         public static T getField () { return field; }
18 }
19
20 public class main {
21         static int i1;
22         static int i2;
23
24         public static void otherThread () {
25                 Gen<IntClass>.setField (new IntClass (2));
26                 i2 = Gen<IntClass>.getField ().get ();
27         }
28
29         public static int Main () {
30                 Gen<IntClass>.setField (new IntClass (1));
31
32                 Thread thread = new Thread (main.otherThread);
33                 thread.Start ();
34                 thread.Join ();
35
36                 i1 = Gen<IntClass>.getField ().get ();
37
38                 if (i1 != 1 || i2 != 2)
39                         return 1;
40                 return 0;
41         }
42 }