[runtime] Synthesize IList and IReadOnlyList for the element type of enum errays...
[mono.git] / mono / tests / finalizer-exit.cs
1
2 using System; 
3 using System.Collections; 
4 using System.Threading;
5
6 public class foo  { 
7         public static LocalDataStoreSlot dataslot = Thread.AllocateDataSlot();
8
9         ~foo() { 
10                 string ID=(string)Thread.GetData(dataslot);
11                 if(ID==null) {
12                         Console.WriteLine("Set ID: foo");
13                         Thread.SetData(dataslot, "foo");
14                 }
15                 Console.WriteLine("finalizer thread ID: {0}", (string)Thread.GetData(dataslot));
16                 Environment.Exit(0);
17         } 
18
19         public static int Main() { 
20                 ArrayList list = new ArrayList (); 
21                 Thread.SetData(dataslot, "ID is wibble");
22                 Environment.ExitCode = 2;
23                 while(true) { 
24                         foo instance = new foo(); 
25                         list.Add (new WeakReference(instance)); 
26                         Thread.Sleep (0);
27                 } 
28                 return 1;
29         } 
30
31