Module: Corkscrews::Hooks

Defined in:
ext/corkscrews/hooks.c

Class Method Summary collapse

Class Method Details

.available?Boolean

Returns:

  • (Boolean)


143
144
145
146
147
148
# File 'ext/corkscrews/hooks.c', line 143

static VALUE
hooks_available_p(VALUE self)
{
    (void)self;
    return Qtrue;
}

.install!Object



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'ext/corkscrews/hooks.c', line 125

static VALUE
hooks_install(VALUE self)
{
    (void)self;
    if (!thread_hook) {
        thread_hook = rb_internal_thread_add_event_hook(
            thread_event_callback,
            RUBY_INTERNAL_THREAD_EVENT_MASK,
            NULL
        );
    }
    if (!gc_hooks_installed) {
        rb_add_event_hook(gc_event_hook, RUBY_INTERNAL_EVENT_GC_ENTER | RUBY_INTERNAL_EVENT_GC_EXIT, Qnil);
        gc_hooks_installed = 1;
    }
    return Qtrue;
}