1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ext/-test-/thread_fd/thread_fd.c

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
662 B
C
Raw Permalink Normal View History

#include "ruby/ruby.h"
static VALUE
thread_fd_close(VALUE ign, VALUE fd)
{
rb_thread_fd_close(NUM2INT(fd));
return Qnil;
}
static VALUE
thread_fd_wait(VALUE ign, VALUE fd)
{
int ret = rb_thread_wait_fd(NUM2INT(fd));
return INT2NUM(ret);
}
static VALUE
thread_fd_writable(VALUE ign, VALUE fd)
{
int ret = rb_thread_fd_writable(NUM2INT(fd));
return INT2NUM(ret);
}
void
2021-07-29 03:23:54 -04:00
Init_thread_fd(void)
{
rb_define_singleton_method(rb_cIO, "thread_fd_close", thread_fd_close, 1);
rb_define_singleton_method(rb_cIO, "thread_fd_wait", thread_fd_wait, 1);
rb_define_singleton_method(rb_cIO, "thread_fd_writable", thread_fd_writable, 1);
}