}
if (heap_number == 0)
{
+ // need to take the gc_lock in preparation for verify_heap below
+ // *before* we suspend the EE, otherwise we get a deadlock
+ enter_gc_lock_for_verify_heap();
+
suspend_EE();
bgc_threads_sync_event.Set();
}
dprintf (2, ("bgc_threads_sync_event is signalled"));
}
#else //MULTIPLE_HEAPS
+ // need to take the gc_lock in preparation for verify_heap below
+ // *before* we suspend the EE, otherwise we get a deadlock
+ enter_gc_lock_for_verify_heap();
+
suspend_EE();
#endif //MULTIPLE_HEAPS
if (heap_number == 0)
{
restart_EE();
+ leave_gc_lock_for_verify_heap();
bgc_threads_sync_event.Set();
}
else
dprintf (2, ("bgc_threads_sync_event is signalled"));
}
#else //MULTIPLE_HEAPS
+
restart_EE();
+ leave_gc_lock_for_verify_heap();
#endif //MULTIPLE_HEAPS
disable_preemptive (cooperative_mode);
#endif //USE_REGIONS
}
+void gc_heap::enter_gc_lock_for_verify_heap()
+{
+#ifdef VERIFY_HEAP
+ if (GCConfig::GetHeapVerifyLevel() & GCConfig::HEAPVERIFY_GC)
+ {
+ enter_spin_lock (&gc_heap::gc_lock);
+ dprintf (SPINLOCK_LOG, ("enter gc_lock for verify_heap"));
+ }
+#endif // VERIFY_HEAP
+}
+
+void gc_heap::leave_gc_lock_for_verify_heap()
+{
+#ifdef VERIFY_HEAP
+ if (GCConfig::GetHeapVerifyLevel() & GCConfig::HEAPVERIFY_GC)
+ {
+ dprintf (SPINLOCK_LOG, ("leave gc_lock taken for verify_heap"));
+ leave_spin_lock (&gc_heap::gc_lock);
+ }
+#endif // VERIFY_HEAP
+}
+
void gc_heap::verify_heap (BOOL begin_gc_p)
{
int heap_verify_level = static_cast<int>(GCConfig::GetHeapVerifyLevel());