Module: Bug::Thread

Defined in:
ext/-test-/gvl/call_without_gvl/call_without_gvl.c

Class Method Summary collapse

Class Method Details

.runnable_sleep(timeout) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'ext/-test-/gvl/call_without_gvl/call_without_gvl.c', line 14

static VALUE
thread_runnable_sleep(VALUE thread, VALUE timeout)
{
    struct timeval timeval;

    if (NIL_P(timeout)) {
        rb_raise(rb_eArgError, "timeout must be non nil");
    }

    timeval = rb_time_interval(timeout);

    rb_thread_call_without_gvl(native_sleep_callback, &timeval, RUBY_UBF_IO, NULL);

    return Qnil;
}

.ubf_async_safe(notify_fd) ⇒ Object



59
60
61
62
63
64
65
66
67
68
69
# File 'ext/-test-/gvl/call_without_gvl/call_without_gvl.c', line 59

static VALUE
thread_ubf_async_safe(VALUE thread, VALUE notify_fd)
{
    struct loop_ctl ctl;

    ctl.notify_fd = NUM2INT(notify_fd);
    ctl.stop = 0;

    rb_nogvl(do_loop, &ctl, stop_set, &ctl, RB_NOGVL_UBF_ASYNC_SAFE);
    return Qnil;
}