Class: MriGilLock::Hold

Inherits:
Object
  • Object
show all
Defined in:
ext/hold/hold.c

Class Method Summary collapse

Class Method Details

.for_microseconds(rubyTimeToHold) ⇒ Object



5
6
7
8
9
# File 'ext/hold/hold.c', line 5

VALUE holdFor(VALUE self, VALUE rubyTimeToHold)
{
    usleep(NUM2UINT(rubyTimeToHold)); // avoid possible collision with ruby sleep functions
    return rubyTimeToHold;
}

.for_two_seconds_without_gil ⇒ Object



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

VALUE holdForTwoSecondsWithoutGil(VALUE self)
{
    // https://silverhammermba.github.io/emberb/c/#c-in-ruby-threads
    rb_thread_call_without_gvl(holdForTwoSeconds, NULL, RUBY_UBF_IO, NULL);
    return self;
}