static int Main() { MyFinalizeObject mfo; // Create objects that require finalization. for (int j = 0; j < numMfos; j++) { mfo = new MyFinalizeObject(); } //Force garbage collection. // all finalizable objects will be placed in Finalization queue. GC.Collect(); MyWaitForPendingFinalizersClass cl = new MyWaitForPendingFinalizersClass(); // Worker loop to perform post-finalization code. for (int i = 0; i < maxIterations; i++) { Console.WriteLine("Doing some post-finalize work"); } // if we got to this point, the test passed since no deadlock happened // inside MyWaitForPendingFinalizersClass class constructor. Console.WriteLine("PASS"); return(100); }
static int Main() { MyFinalizeObject mfo; // Create objects that require finalization. for (int j = 0; j < numMfos; j++) { mfo = new MyFinalizeObject(); } //Force garbage collection. // all finalizable objects will be placed in Finalization queue. GC.Collect(); MyWaitForPendingFinalizersClass cl = new MyWaitForPendingFinalizersClass(); // Worker loop to perform post-finalization code. for (int i = 0; i < maxIterations; i++) { Console.WriteLine("Doing some post-finalize work"); } // if we got to this point, the test passed since no deadlock happened // inside MyWaitForPendingFinalizersClass class constructor. Console.WriteLine("PASS"); return 100; }