Module: GVLTest

Defined in:
lib/gvltest/version.rb,
ext/gvltest/gvltest.c

Constant Summary collapse

VERSION =
"0.3.0"

Class Method Summary collapse

Class Method Details

.nogvl_nopObject



44
45
46
47
# File 'ext/gvltest/gvltest.c', line 44

static VALUE nogvl_nop(VALUE self) {
    rb_thread_call_without_gvl(nop, NULL, NULL, NULL);
    return Qnil;
}

.sleep_holding_gvl(timev) ⇒ Object



16
17
18
19
20
21
22
# File 'ext/gvltest/gvltest.c', line 16

static VALUE sleep_holding_gvl(VALUE self, VALUE timev) {
    double time = NUM2DBL(timev);
    unsigned long long int ns = time * 1E9;
    struct timespec ts = { ns / 1000000000LL, ns % 1000000000LL };
    durable_sleep(ts);
    return timev;
}

.sleep_without_gvl(timev) ⇒ Object



30
31
32
33
34
35
36
37
# File 'ext/gvltest/gvltest.c', line 30

static VALUE sleep_without_gvl(VALUE self, VALUE timev) {
    double time = NUM2DBL(timev);
    unsigned long long int ns = time * 1E9;
    struct timespec ts = { ns / 1000000000LL, ns % 1000000000LL };

    rb_thread_call_without_gvl(sleep_without_gvl_i, &ts, NULL, NULL);
    return Qnil;
}