2 using System.Collections;
3 using System.Threading;
4 using System.Collections.Generic;
9 static List<Foo> list = new List<Foo> ();
15 public static void CreateFoo (int level)
18 reference = new Foo ();
20 /* Allocate a MonoThreadsSync for the object */
21 Monitor.Enter (reference);
22 Monitor.Exit (reference);
25 CreateFoo (level - 1);
29 public static int Main() {
30 /* Allocate an object down the stack so it doesn't get pinned */
33 Console.WriteLine (".");
37 GC.WaitForPendingFinalizers ();
39 /* Allocate MonoThreadsSyncs for another thread that are locked */
40 Thread t = new Thread (new ThreadStart (resurrect.Func));
44 /* Make sure that none of the other structures overlap with the original one */
45 Monitor.Enter (resurrect);
50 for (int i = 0; i < 100; i++) {
52 /* Make sure these are not collected */