[tests] Test loading references from LoadFrom and LoadFile contexts
[mono-project.git] / mono / tests / finalizer-exit.cs
blob89c1f8c796b9f5ebc56a5aacde9ed87f40b365f9
2 using System;
3 using System.Collections;
4 using System.Threading;
6 public class foo {
7 public static LocalDataStoreSlot dataslot = Thread.AllocateDataSlot();
9 ~foo() {
10 string ID=(string)Thread.GetData(dataslot);
11 if(ID==null) {
12 Console.WriteLine("Set ID: foo");
13 Thread.SetData(dataslot, "foo");
15 Console.WriteLine("finalizer thread ID: {0}", (string)Thread.GetData(dataslot));
16 Environment.Exit(0);
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);
28 return 1;