mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/io-console] Use rb_thread_call_without_gvl instead of the deprecated function
https://github.com/ruby/io-console/commit/21338ab287
This commit is contained in:
parent
09723b98f7
commit
f9c0fe77c0
1 changed files with 4 additions and 3 deletions
|
@ -4,6 +4,7 @@
|
||||||
*/
|
*/
|
||||||
#include "ruby.h"
|
#include "ruby.h"
|
||||||
#include "ruby/io.h"
|
#include "ruby/io.h"
|
||||||
|
#include "ruby/thread.h"
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -454,7 +455,7 @@ getc_call(VALUE io)
|
||||||
return rb_funcallv(io, id_getc, 0, 0);
|
return rb_funcallv(io, id_getc, 0, 0);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static VALUE
|
static void *
|
||||||
nogvl_getch(void *p)
|
nogvl_getch(void *p)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
|
@ -473,7 +474,7 @@ nogvl_getch(void *p)
|
||||||
buf[len++] = c;
|
buf[len++] = c;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return (VALUE)len;
|
return (void *)(VALUE)len;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -521,7 +522,7 @@ console_getch(int argc, VALUE *argv, VALUE io)
|
||||||
rb_warning("vtime option ignored if intr flag is unset");
|
rb_warning("vtime option ignored if intr flag is unset");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
len = (int)rb_thread_io_blocking_region(nogvl_getch, wbuf, fptr->fd);
|
len = (int)(VALUE)rb_thread_call_without_gvl(nogvl_getch, wbuf, RUBY_UBF_IO, 0);
|
||||||
switch (len) {
|
switch (len) {
|
||||||
case 0:
|
case 0:
|
||||||
return Qnil;
|
return Qnil;
|
||||||
|
|
Loading…
Reference in a new issue