+#if defined(THREADED_RTS)
+ postEvent(cap, EVENT_GC_START, 0, 0);
+ debugTrace(DEBUG_sched, "doing GC");
+ // reset waiting_for_gc *before* GC, so that when the GC threads
+ // emerge they don't immediately re-enter the GC.
+ waiting_for_gc = 0;
+ GarbageCollect(force_major || heap_census, gc_type, cap);
+#else
+ GarbageCollect(force_major || heap_census, 0, cap);
+#endif
+ postEvent(cap, EVENT_GC_END, 0, 0);
+