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 Foo.reference = new Foo ();
20 CreateFoo (level - 1);
23 public static int Main() {
24 /* Allocate an object down the stack so it doesn't get pinned */
27 /* Allocate a MonoThreadsSync for the object */
28 Monitor.Enter (reference);
29 Monitor.Exit (reference);
34 GC.WaitForPendingFinalizers ();
36 /* Allocate MonoThreadsSyncs for another thread that are locked */
37 Thread t = new Thread (new ThreadStart (resurrect.Func));
41 /* Make sure that none of the other structures overlap with the original one */
42 Monitor.Enter (resurrect);
47 for (int i = 0; i < 100; i++) {
49 /* Make sure these are not collected */