/// <summary> /// Start the finalization thread. /// </summary> internal static void StartFinalizerThread() { #if !(REFERENCE_COUNTING_GC || DEFERRED_REFERENCE_COUNTING_GC) if (GC.gcType == Microsoft.Bartok.Runtime.GCType.NullCollector) { return; } // HACK: Threading issues are preventing use of a Finalizer thread. // Disabling for ARM so the GC can be used without it. #if !OS_WINCE && !ISA_ARM WorkExistsForFinalizerThread = new AutoResetEvent(false); WaitForPendingShouldReturn = new ManualResetEvent(true); #if SINGULARITY_KERNEL spinLock = new SpinLock(SpinLock.Types.Finalizer); finalizerThread = Thread.CreateThread(null, new ThreadStart(ThreadLoop)); VTable.Assert(finalizerThread != null); running = true; finalizerThread.Start(); #elif SINGULARITY_PROCESS finalizerThread = new Thread(new ThreadStart(ThreadLoop)); finalizerThread.SetIgnoredByJoinAll(); running = true; finalizerThread.Start(); #else // !SINGULARITY finalizerThread = new Thread(new ThreadStart(ThreadLoop)); running = true; finalizerThread.Start(); #endif // !SINGULARITY #endif // REFERENCE_COUNTING_GC #endif // !OS_WINCE }