void Init_PostGC(void) { if (!gc_disabled) { objc_startCollectorThread(); auto_collector_reenable(__auto_zone); } }
VALUE rb_gc_enable(VALUE self, SEL sel) { int old = dont_gc; auto_collector_reenable(__auto_zone); dont_gc = Qfalse; return old ? Qtrue : Qfalse; }
static VALUE os_each_obj(VALUE os, SEL sel, int argc, VALUE *argv) { VALUE of; int count; rb_secure(4); if (argc == 0) { of = 0; } else { rb_scan_args(argc, argv, "01", &of); } RETURN_ENUMERATOR(os, 1, &of); /* Class/Module are a special case, because they are not auto objects */ if (of == rb_cClass || of == rb_cModule) { count = rb_objc_yield_classes(of); } else { struct rb_objc_recorder_context ctx = {of, 0, Qundef}; auto_collector_disable(__auto_zone); (((malloc_zone_t *)__auto_zone)->introspect->enumerator)( mach_task_self(), (void *)&ctx, MALLOC_PTR_IN_USE_RANGE_TYPE, (vm_address_t)__auto_zone, NULL, rb_objc_recorder); auto_collector_reenable(__auto_zone); if (ctx.break_value != Qundef) { return ctx.break_value; } count = ctx.count; } return INT2FIX(count); }