Skip to content

Commit 21338ab

Browse files
committed
Use rb_thread_call_without_gvl instead of the deprecated function
1 parent 499ff3d commit 21338ab

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ext/io/console/console.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55
#include "ruby.h"
66
#include "ruby/io.h"
7+
#include "ruby/thread.h"
78

89
#ifdef HAVE_UNISTD_H
910
#include <unistd.h>
@@ -454,7 +455,7 @@ getc_call(VALUE io)
454455
return rb_funcallv(io, id_getc, 0, 0);
455456
}
456457
#else
457-
static VALUE
458+
static void *
458459
nogvl_getch(void *p)
459460
{
460461
int len = 0;
@@ -472,7 +473,7 @@ nogvl_getch(void *p)
472473
buf[len++] = c;
473474
break;
474475
}
475-
return (VALUE)len;
476+
return (void *)(VALUE)len;
476477
}
477478
#endif
478479

@@ -520,7 +521,7 @@ console_getch(int argc, VALUE *argv, VALUE io)
520521
rb_warning("vtime option ignored if intr flag is unset");
521522
}
522523
}
523-
len = (int)rb_thread_io_blocking_region(nogvl_getch, wbuf, fptr->fd);
524+
len = (int)(VALUE)rb_thread_call_without_gvl(nogvl_getch, wbuf, RUBY_UBF_IO, 0);
524525
switch (len) {
525526
case 0:
526527
return Qnil;

0 commit comments

Comments
 (0)